-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
59 additions
and
31 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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
name: Rust | ||
|
||
# Template Reference: https://www.infinyon.com/blog/2021/04/github-actions-best-practices/ | ||
|
||
on: | ||
push: | ||
branches: [ master, codeforce, dev ] | ||
branches: [ master, dev ] | ||
pull_request: | ||
branches: [ master, codeforce ] | ||
branches: [ master ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
@@ -18,7 +18,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
rust: [stable, 1.56, 1.61] | ||
rust: [stable, 1.72] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust ${{ matrix.rust }} | ||
|
@@ -27,19 +27,23 @@ jobs: | |
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
- name: Run sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
- name: Get Date | ||
id: get-date | ||
run: | | ||
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | ||
shell: bash | ||
- name: Cache cargo registry | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-build | ||
key: rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-${{ steps.get-date.outputs.date }}-build | ||
restore-keys: | | ||
${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}- | ||
${{ runner.os }}-cargo-${{ matrix.rust }}- | ||
${{ runner.os }}-cargo- | ||
rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}- | ||
rust-${{ runner.os }} | ||
# Real tests starts here | ||
- name: Check version | ||
run: rustup --version && rustc --version && cargo --version | ||
|
@@ -48,36 +52,56 @@ jobs: | |
rustup component add rustfmt | ||
which rustfmt && rustfmt --version | ||
- name: Build | ||
run: cargo build --verbose | ||
run: | | ||
cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose | ||
run: | | ||
cargo test --verbose | ||
- name: Install | ||
run: cargo install --path . | ||
run: | | ||
cargo install --path . | ||
- name: Package | ||
run: cargo package --verbose | ||
run: | | ||
cargo package --verbose | ||
- name: clippy | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
rustup component add clippy | ||
cargo clippy | ||
- name: Run sccache stat for check | ||
shell: bash | ||
run: ${SCCACHE_PATH} --show-stats | ||
|
||
|
||
|
||
|
||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust ${{ matrix.rust }} | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
- name: Run sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
- name: Get Date | ||
id: get-date | ||
run: | | ||
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | ||
shell: bash | ||
- name: Cache cargo registry | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-coverage | ||
key: rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-${{ steps.get-date.outputs.date }}-build | ||
restore-keys: | | ||
${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}- | ||
${{ runner.os }}-cargo-${{ matrix.rust }}- | ||
${{ runner.os }}-cargo- | ||
- uses: actions/checkout@v2 | ||
rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}- | ||
rust-${{ runner.os }} | ||
- name: Build And Coverage | ||
run: ./coverage.sh | ||
- uses: actions/upload-artifact@v2 | ||
|
@@ -90,25 +114,29 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust stable | ||
- name: Install Rust ${{ matrix.rust }} | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
- name: Run sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
- name: Get Date | ||
id: get-date | ||
run: | | ||
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | ||
shell: bash | ||
- name: Cache cargo registry | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.toml') }}-release | ||
key: rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}-${{ steps.get-date.outputs.date }}-build | ||
restore-keys: | | ||
${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.toml') }}- | ||
${{ runner.os }}-cargo-stable- | ||
${{ runner.os }}-cargo- | ||
rust-${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}- | ||
rust-${{ runner.os }} | ||
# End of rust template | ||
# - name: Install toolkit | ||
# run: cargo install cargo-bump | ||
|