diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2022-11-11 23:45:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 23:45:27 -0500 |
commit | f41e7cd66df32d159191e3073bfab1eb7ab91e95 (patch) | |
tree | fcace8fbd893bf5e19684b5a98602ddaab88ff15 /.github | |
parent | 1960c40a30f4654fc4d3e9dec91783b6c1187f6b (diff) |
ci: unify cache keys in actions (#890)
* ci: unify cache keys in actions
* some docs
* because empty strings are false in JS
* update comment
* fix build cache naming
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/build_releases.yml | 47 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 24 | ||||
-rw-r--r-- | .github/workflows/coverage.yml | 6 |
3 files changed, 57 insertions, 20 deletions
diff --git a/.github/workflows/build_releases.yml b/.github/workflows/build_releases.yml index 66c89866..072c690a 100644 --- a/.github/workflows/build_releases.yml +++ b/.github/workflows/build_releases.yml @@ -19,11 +19,10 @@ on: type: string env: - CARGO_INCREMENTAL: 0 RUST_BACKTRACE: 1 - BTM_GENERATE: true - COMPLETION_DIR: "target/tmp/bottom/completion/" - MANPAGE_DIR: "target/tmp/bottom/manpage/" + CARGO_INCREMENTAL: 0 + CARGO_PROFILE_DEV_DEBUG: 0 + CARGO_HUSKY_DONT_INSTALL_HOOKS: true jobs: build-binaries: @@ -137,8 +136,18 @@ jobs: sh rustup.sh --default-toolchain stable -y echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: Enable Rust cache + uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # 2.2.0 + with: + shared-key: build-cache-${{ matrix.info.target }} + save-if: "false" + - name: Build uses: ClementTsang/cargo-action@v0.0.3 + env: + COMPLETION_DIR: "target/tmp/bottom/completion/" + MANPAGE_DIR: "target/tmp/bottom/manpage/" + BTM_GENERATE: true with: command: build args: --release --verbose --locked --target=${{ matrix.info.target }} --features deploy @@ -199,8 +208,6 @@ jobs: build-msi: name: "Build MSI installer" runs-on: "windows-2019" - env: - BTM_GENERATE: "" steps: - name: Checkout repository uses: actions/checkout@v3 @@ -222,8 +229,18 @@ jobs: toolchain: stable target: x86_64-pc-windows-msvc + - name: Enable Rust cache + uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # 2.2.0 + with: + key: "build-cache-x86_64-pc-windows-msvc" + save-if: "false" + - name: Build MSI file shell: powershell + env: + BTM_GENERATE: "" + COMPLETION_DIR: "target/tmp/bottom/completion/" + MANPAGE_DIR: "target/tmp/bottom/manpage/" run: | cargo install cargo-wix --version 0.3.1 --locked cargo wix init @@ -300,8 +317,18 @@ jobs: toolchain: stable target: ${{ matrix.info.target }} + - name: Enable Rust cache + uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # 2.2.0 + with: + shared-key: build-cache-${{ matrix.info.target }} + save-if: "false" + - name: Build uses: ClementTsang/cargo-action@v0.0.3 + env: + BTM_GENERATE: true + COMPLETION_DIR: "target/tmp/bottom/completion/" + MANPAGE_DIR: "target/tmp/bottom/manpage/" with: command: build args: --release --locked --verbose --features deploy --target ${{ matrix.info.target }} @@ -320,6 +347,10 @@ jobs: - name: Build Debian release (x86-64) if: matrix.info.cross == false + env: + BTM_GENERATE: true + COMPLETION_DIR: "target/tmp/bottom/completion/" + MANPAGE_DIR: "target/tmp/bottom/manpage/" run: | cargo install cargo-deb --version 1.38.0 --locked cargo deb --no-build --target ${{ matrix.info.target }} @@ -327,6 +358,10 @@ jobs: - name: Build Debian release (ARM) if: matrix.info.cross == true + env: + BTM_GENERATE: true + COMPLETION_DIR: "target/tmp/bottom/completion/" + MANPAGE_DIR: "target/tmp/bottom/manpage/" run: | docker pull ${{ matrix.info.container }} docker run -t --rm --mount type=bind,source="$(pwd)",target=/volume ${{ matrix.info.container }} "--variant ${{ matrix.info.dpkg }} --target ${{ matrix.info.target }} --no-build" "/volume" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d19c66d7..735db54c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,18 @@ -# Main CI workflow to validate PRs. +# Main CI workflow to validate PRs and branches are correctly formatted +# and pass tests. # -# CI workflow based on: +# CI workflow was based on a lot of work from other people: # - https://github.com/heim-rs/heim/blob/master/.github/workflows/ci.yml # - https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/ci.yml # - https://www.reillywood.com/blog/rust-faster-ci/ +# - https://matklad.github.io/2021/09/04/fast-rust-builds.html # -# It should run the following: -# Supported platforms: +# Supported platforms run the following tasks: # - cargo fmt -# - cargo test -# - cargo clippy after (apparently faster to do so) +# - cargo test (built/test in separate steps) +# - cargo clippy (apparently faster to do it after the build/test) # -# Unsupported platforms: +# Unsupported platforms run the following tasks: # - cargo check name: ci @@ -24,6 +25,7 @@ on: - master env: + RUST_BACKTRACE: 1 CARGO_INCREMENTAL: 0 CARGO_PROFILE_DEV_DEBUG: 0 CARGO_HUSKY_DONT_INSTALL_HOOKS: true @@ -85,10 +87,10 @@ jobs: target: ${{ matrix.info.target }} - name: Enable Rust cache - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1 + uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # 2.2.0 if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork with: - key: ${{ matrix.info.target }} + shared-key: build-cache-${{ matrix.info.target }} - name: Check cargo fmt run: cargo fmt --all -- --check @@ -228,10 +230,10 @@ jobs: target: ${{ matrix.info.target }} - name: Enable Rust cache - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1 + uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # 2.2.0 if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork with: - key: ${{ matrix.info.target }} + shared-key: build-cache-${{ matrix.info.target }} - name: Check uses: ClementTsang/cargo-action@v0.0.3 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 35c91820..0613145b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,4 +1,5 @@ -# Code coverage generation via cargo-llvm-cov, which is then uploaded to codecov. +# Code coverage generation via cargo-llvm-cov, which is then uploaded to Codecov. +# Codecov will report back via a comment if run on a PR. name: codecov @@ -43,8 +44,7 @@ jobs: toolchain: stable - name: Enable Rust cache - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1 - if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork + uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # 2.2.0 - name: Install cargo-llvm-cov run: | |