-
Notifications
You must be signed in to change notification settings - Fork 35
[Feat] Add linux build action #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhouang777
wants to merge
7
commits into
main
Choose a base branch
from
add-linux-build-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
51f8c80
feat: add linux ubuntu build
zhouang777 4ac4d60
rename artifacts
zhouang777 4ed13fb
fix build output name
zhouang777 1dc9097
rename artifact with version
zhouang777 304a970
Update .github/workflows/bazel_cli_build.yml
zhouang777 e25503c
Update .github/workflows/bazel_cli_build.yml
zhouang777 f3ff3c0
Update .github/workflows/bazel_cli_build.yml
zhouang777 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
name: Bazel CLI Build (macOS) | ||
name: Bazel CLI Build | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- 'doc/**' | ||
- 'example/**' | ||
- '**/*.md' | ||
tags: | ||
- '*' | ||
pull_request: | ||
paths-ignore: | ||
- 'doc/**' | ||
|
@@ -15,8 +17,56 @@ on: | |
|
||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install Software | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y python3 nodejs clang-13 libclang-13-dev python3-pip build-essential | ||
sudo python3 -m pip install pip==24.0 | ||
sudo ln -sf /usr/bin/python3 /usr/bin/python | ||
sudo ln -sf /usr/bin/clang-13 /usr/bin/clang | ||
sudo ln -sf /usr/bin/clang++-13 /usr/bin/clang++ | ||
- name: Set up Bazel | ||
uses: bazel-contrib/[email protected] | ||
with: | ||
bazelisk-cache: true | ||
disk-cache: ${{ github.workflow }} | ||
repository-cache: true | ||
- name: Build All | ||
run: bazel build //... | ||
- name: Prepare artifact name and copy | ||
run: | | ||
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | ||
TAG_NAME="${GITHUB_REF#refs/tags/}" | ||
ARTIFACT_NAME="sparrow-cli-${TAG_NAME}-linux" | ||
cp bazel-bin/sparrow-cli.tar.gz "${ARTIFACT_NAME}.tar.gz" | ||
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV | ||
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV | ||
else | ||
SHORT_COMMIT="$(echo ${{ github.sha }} | cut -c1-7)" | ||
ARTIFACT_NAME="sparrow-cli-${SHORT_COMMIT}-linux" | ||
cp bazel-bin/sparrow-cli.tar.gz "${ARTIFACT_NAME}.tar.gz" | ||
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV | ||
fi | ||
- name: Upload sparrow-cli.tar.gz artifact | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.ARTIFACT_NAME }} | ||
path: ${{ env.ARTIFACT_NAME }}.tar.gz | ||
- name: Upload to Release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: ${{ env.ARTIFACT_NAME }}.tar.gz | ||
|
||
build-macos: | ||
runs-on: macos-latest | ||
runs-on: macos-14 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
@@ -32,8 +82,19 @@ jobs: | |
repository-cache: true | ||
- name: Build All | ||
run: bazel build //... | ||
- name: Copy and rename artifact | ||
uses: ./.github/actions/copy-artifact | ||
with: | ||
source: bazel-bin/sparrow-cli.tar.gz | ||
platform: mac | ||
- name: Upload sparrow-cli.tar.gz artifact | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sparrow-cli | ||
path: bazel-bin/sparrow-cli.tar.gz | ||
name: ${{ env.ARTIFACT_NAME }} | ||
path: sparrow-cli-*-mac.tar.gz | ||
- name: Upload to Release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: sparrow-cli-${{ env.TAG_NAME }}-mac.tar.gz |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failed at this line