From 52108092d18ead72e3f08c1beed42e75732cab35 Mon Sep 17 00:00:00 2001 From: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com> Date: Sat, 19 Oct 2024 10:36:32 +0800 Subject: [PATCH] Updated github action Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com> --- .github/workflows/rust.yml | 79 +++++++++++++++++++++++++------------- Cargo.toml | 7 ++++ 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c280d14..446b6fb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,36 +18,61 @@ jobs: steps: - name: Download apt packages run: | - sudo apt-get update -y && sudo apt-get install -y libsfml-dev libcsfml-dev libasound2-dev libgtk-3-dev libatk1.0-dev libpango1.0-dev libudev-dev + sudo apt-get update -y && sudo apt-get install -y libasound2-dev libudev-dev - - name: Install cargo-tarpaulin - uses: actions-rs/install@v0.1 + - uses: actions-rs/toolchain@v1 with: - crate: cargo-tarpaulin - version: latest - use-tool-cache: true + profile: minimal + toolchain: stable + override: true + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov - - uses: actions/checkout@v2 + - name: Use sccache-cache + uses: mozilla-actions/sccache-action@v0.0.6 - - uses: actions-rs/audit-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v4 + + # breaks for now since Cargo.lock is in a new version (4) + # - uses: actions-rs/audit-check@v1 + # with: + # token: ${{ secrets.GITHUB_TOKEN }} - name: Build - run: cargo build --verbose - - - name: Run test cargo-tarpaulin - run: cargo tarpaulin -t 300 --workspace -e nes_ui_native_windows nes_ui_sfml nes_ui_gtk nes_ui_tui -v -o Xml - - - uses: codecov/codecov-action@v1.0.11 - - # For some reason windows crashes when running the emulator tests - #windows: - # runs-on: windows-latest - # - # steps: - # - uses: actions/checkout@v2 - # - name: Build native windows UI - # run: cargo build -p nes_ui_native_windows --verbose - # - name: Run tests - # run: cargo test --workspace --exclude nes_ui_gtk --exclude nes_ui_sfml --lib + run: cargo build --verbose --all --all-targets --profile=ci + env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + + # runs cargo with defaults flags, using the default `lcov` output + - name: Test + run: cargo llvm-cov --all-features --workspace --exclude plastic_ui --exclude plastic_ui_tui --lcov --output-path lcov.info + env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + + # afterwards, upload the report to codecov + - uses: codecov/codecov-action@v1 + with: + files: lcov.info + fail_ci_if_error: true + + windows: + runs-on: windows-latest + + steps: + + - name: Use sccache-cache + uses: mozilla-actions/sccache-action@v0.0.6 + - uses: actions/checkout@v4 + - name: Build + run: cargo build --all --all-targets --profile=ci + env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + - name: Test + run: cargo test --workspace --exclude plastic_ui --exclude plastic_ui_tui --lib + env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + diff --git a/Cargo.toml b/Cargo.toml index ef8e6a3..978f3da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,3 +12,10 @@ opt-level = 2 [profile.release] opt-level = 3 +[profile.ci] +inherits = "dev" +opt-level = 1 +codegen-units = 16 +debug = false +overflow-checks = false +lto = false