-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chawye Hsu <[email protected]>
- Loading branch information
Showing
1 changed file
with
31 additions
and
49 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 |
---|---|---|
|
@@ -9,45 +9,36 @@ permissions: | |
contents: write | ||
pull-requests: write | ||
jobs: | ||
# Check code style and tests | ||
check_cargo_base: | ||
name: Check Code Style | ||
# format and lint check | ||
style_check: | ||
name: Code Style Check | ||
runs-on: windows-latest | ||
env: | ||
SCCACHE_GHA_ENABLED: true | ||
RUSTC_WRAPPER: sccache | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Rust | ||
- name: Rust Setup | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
components: clippy, rustfmt | ||
|
||
- name: Setup Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache Setup | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Format Check | ||
run: cargo fmt -- --check | ||
|
||
- name: Clippy Check | ||
run: cargo clippy | ||
|
||
- name: Tests Check | ||
run: cargo test --workspace | ||
|
||
# Check build | ||
check_cargo_build: | ||
name: Check Dev Build | ||
needs: check_cargo_base | ||
# tests and build | ||
test_build: | ||
name: Test Build | ||
needs: style_check | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -56,35 +47,32 @@ jobs: | |
- target: i686-pc-windows-msvc | ||
- target: aarch64-pc-windows-msvc | ||
runs-on: windows-latest | ||
env: | ||
SCCACHE_GHA_ENABLED: true | ||
RUSTC_WRAPPER: sccache | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Rust | ||
- name: Rust Setup | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
|
||
- name: Setup Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache Setup | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Tests Check | ||
run: cargo test --workspace | ||
|
||
- name: Build Check | ||
run: cargo build --locked --target ${{ matrix.target }} | ||
|
||
# Create/Update release PR | ||
release_please: | ||
name: Release Please | ||
needs: check_cargo_build | ||
needs: test_build | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'chawyehsu/hok' && github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
steps: | ||
|
@@ -121,27 +109,21 @@ jobs: | |
|
||
runs-on: ${{ matrix.os }} | ||
continue-on-error: true | ||
env: | ||
SCCACHE_GHA_ENABLED: true | ||
RUSTC_WRAPPER: sccache | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Rust | ||
- name: Rust Setup | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
|
||
- name: Setup Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache Setup | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Build | ||
uses: actions-rs/[email protected] | ||
|
@@ -186,7 +168,7 @@ jobs: | |
|
||
# Create GitHub release with Rust build targets and release notes | ||
upload_artifacts: | ||
name: Add Build Artifacts to Release | ||
name: Create Release | ||
needs: [release_please, github_build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -201,7 +183,7 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Add Artifacts to Release | ||
- name: Attach Artifacts | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: hok-*/hok-* | ||
|