-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from titanom/ci/clean-up
- Loading branch information
Showing
3 changed files
with
161 additions
and
100 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -39,103 +39,3 @@ jobs: | |
with: | ||
command: clippy | ||
args: -- -D warnings | ||
|
||
build-linux: | ||
name: Build for x86_64-unknown-linux-musl | ||
needs: check | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: mozilla-actions/[email protected] | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
target: x86_64-unknown-linux-musl | ||
|
||
- run: sudo apt-get update && sudo apt install musl-tools | ||
|
||
- name: Build for x86_64-unknown-linux-musl | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --target x86_64-unknown-linux-musl | ||
|
||
- name: Store build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: x86_64-unknown-linux-musl | ||
path: ./target/x86_64-unknown-linux-musl/release/bwenv | ||
|
||
build-apple-silicon: | ||
name: Build aarch64-apple-darwin | ||
needs: check | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: mozilla-actions/[email protected] | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
target: aarch64-apple-darwin | ||
|
||
- name: Build for aarch64-apple-darwin | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --target aarch64-apple-darwin | ||
|
||
- name: Store build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: aarch64-apple-darwin | ||
path: ./target/aarch64-apple-darwin/release/bwenv | ||
|
||
release: | ||
name: Release | ||
needs: | ||
- build-linux | ||
- build-apple-silicon | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download build artifacts for x86_64-unknown-linux-musl | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: x86_64-unknown-linux-musl | ||
path: ./x86_64-unknown-linux-musl | ||
|
||
- name: Download build artifacts for aarch64-apple-darwin | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: aarch64-apple-darwin | ||
path: ./aarch64-apple-darwin | ||
|
||
- name: Create archive for x86_64-unknown-linux-musl | ||
run: zip -r -j bwenv-x86_64-unknown-linux-musl.zip x86_64-unknown-linux-musl/bwenv | ||
|
||
- name: Create archive for aarch64-apple-darwin | ||
run: zip -r -j bwenv-aarch64-apple-darwin.zip aarch64-apple-darwin/bwenv | ||
|
||
- name: Read version from Cargo.toml | ||
id: get_version | ||
run: echo "version=$(awk -F' = ' '/^version/ {gsub(/"/, "", $2); print $2}' Cargo.toml)" >> $GITHUB_OUTPUT | ||
|
||
- name: ls | ||
run: ls -la | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./bwenv-x86_64-unknown-linux-musl.zip | ||
./bwenv-aarch64-apple-darwin.zip | ||
tag_name: "v${{ steps.get_version.outputs.version }}" | ||
name: "Release v${{ steps.get_version.outputs.version }}" |
This file contains 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 |
---|---|---|
@@ -0,0 +1,153 @@ | ||
on: | ||
workflow_dispatch: | ||
|
||
name: CI | ||
|
||
env: | ||
SCCACHE_GHA_ENABLED: "true" | ||
RUSTC_WRAPPER: "sccache" | ||
|
||
jobs: | ||
check: | ||
name: Check, Format, Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: mozilla-actions/[email protected] | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
||
- name: Format | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
- name: Lint | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings | ||
|
||
build: | ||
name: Build on ${{ matrix.os }} for ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
arch: [x86_64, aarch64] | ||
lib: [gnu, musl] | ||
exclude: | ||
- os: macos-latest | ||
lib: musl | ||
- os: ubuntu-latest | ||
arch: aarch64 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: mozilla-actions/[email protected] | ||
|
||
- name: Compute Linux Target | ||
id: linux-target | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: echo "target=${{ matrix.arch }}-unknown-linux-${{ matrix.lib }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Compute Apple Target | ||
id: apple-target | ||
if: startsWith(matrix.os, 'macos') | ||
run: echo "target=${{ matrix.arch }}-apple-darwin" >> $GITHUB_OUTPUT | ||
|
||
- name: Print Target | ||
id: target | ||
run: echo "target=${{ steps.linux-target.outputs.target || steps.apple-target.outputs.target }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Print Actual Target | ||
run: echo "${{ steps.target.outputs.target }}" | ||
|
||
- name: Install Rust Toolchain | ||
run: rustup target add ${{ steps.target.outputs.target }} | ||
|
||
- name: Install musl Compiler | ||
if: startsWith(matrix.lib, 'musl') | ||
run: sudo apt-get update && sudo apt install musl-tools | ||
|
||
- name: Build Target ${{ steps.target.outputs.target }} | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --target ${{ steps.target.outputs.target }} | ||
|
||
- name: Upload Build Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.target.outputs.target }} | ||
path: ./target/${{ steps.target.outputs.target }}/release/bwenv | ||
|
||
|
||
release: | ||
name: Release | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download build artifacts for x86_64-unknown-linux-gnu | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: x86_64-unknown-linux-musl | ||
path: ./x86_64-unknown-linux-musl | ||
|
||
- name: Download build artifacts for x86_64-unknown-linux-musl | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: x86_64-unknown-linux-musl | ||
path: ./x86_64-unknown-linux-musl | ||
|
||
- name: Download build artifacts for aarch64-apple-darwin | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: aarch64-apple-darwin | ||
path: ./aarch64-apple-darwin | ||
|
||
- name: Download build artifacts for x86_64-apple-darwin | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: x86_64-apple-darwin | ||
path: ./x86_64-apple-darwin | ||
|
||
- name: Create archive for x86_64-unknown-linux-grnu | ||
run: zip -r -j bwenv-x86_64-unknown-linux-gnu.zip x86_64-unknown-linux-gnu/bwenv | ||
|
||
- name: Create archive for x86_64-unknown-linux-musl | ||
run: zip -r -j bwenv-x86_64-unknown-linux-musl.zip x86_64-unknown-linux-musl/bwenv | ||
|
||
- name: Create archive for aarch64-apple-darwin | ||
run: zip -r -j bwenv-aarch64-apple-darwin.zip aarch64-apple-darwin/bwenv | ||
|
||
- name: Create archive for x86_64-apple-darwin | ||
run: zip -r -j bwenv-x86_64-apple-darwin.zip x86_64-apple-darwin/bwenv | ||
|
||
- name: Read version from Cargo.toml | ||
id: get_version | ||
run: echo "version=$(awk -F' = ' '/^version/ {gsub(/"/, "", $2); print $2}' Cargo.toml)" >> $GITHUB_OUTPUT | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./bwenv-x86_64-unknown-linux-gnu.zip | ||
./bwenv-x86_64-unknown-linux-musl.zip | ||
./bwenv-aarch64-apple-darwin.zip | ||
./bwenv-x86_64-apple-darwin.zip | ||
tag_name: "v${{ steps.get_version.outputs.version }}" | ||
name: "Release v${{ steps.get_version.outputs.version }}" |
This file contains 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