Skip to content

Commit

Permalink
modify CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryang20718 committed Dec 26, 2023
1 parent 73f70f7 commit 27eedd5
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@ jobs:
os: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Run Linters
shell: bash
run: tools/trunk check

- name: Build Linux X86 64 binary
shell: bash
run: tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //bazel_disk_cache_cleaner
run: |
tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //bazel_disk_cache_cleaner
mv bazel-bin/bazel_disk_cache_cleaner/bazel_disk_cache_cleaner_/bazel_disk_cache_cleaner /tmp/bazel_disk_cache_cleaner_linux_amd64
- name: Build Darwin arm 64 binary
shell: bash
run: tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //bazel_disk_cache_cleaner
run: |
tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //bazel_disk_cache_cleaner
- name: Build Darwin X86 64 binary
shell: bash
run: tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //bazel_disk_cache_cleaner
run: |
tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //bazel_disk_cache_cleaner
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build Linux X86 64 binary
shell: bash
run: |
tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //bazel_disk_cache_cleaner
- name: Build Darwin arm 64 binary
shell: bash
run: |
tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_arm64 //bazel_disk_cache_cleaner
- name: Build Darwin X86 64 binary
shell: bash
run: |
tools/bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //bazel_disk_cache_cleaner
cp
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Release ${{ github.ref }}
draft: false
prerelease: false
- uses: xresloader/upload-to-github-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "*.md;*.zip;random-name-*.txt"
release_id: ${{ steps.create_release.outputs.id }}
overwrite: true
verbose: true
7 changes: 4 additions & 3 deletions tools/bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
set -eu -o pipefail

platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
os=${OSTYPE//[0-9.]/}
os=${OSTYPE%%-*}
os=${os//[0-9]/}
arch="$(uname -m)"

if [[ ${arch} == "x86_64" ]]; then
arch="amd64"
if [[ ${arch} == "amd64" ]]; then
arch="x86_64"
fi

BAZEL_VERSION="6.4.0"
Expand Down

0 comments on commit 27eedd5

Please sign in to comment.