From 850a985692e13bee3b8a060388c05af2699b2b8c Mon Sep 17 00:00:00 2001 From: micolous Date: Thu, 27 Apr 2023 22:35:24 +1000 Subject: [PATCH] use sccache, merge "test" actions into "build", remove homebrew caching (#1578) * use sccache, merge "test" actions into "build", remove homebrew caching * rename some actions, make windows build in debug mode to be consistent with tests * run CI on Windows for pull requests, only upload to releases for the correct repo * Don't need rust on ubuntu-latest --- .github/workflows/clippy.yml | 19 ++++------ .github/workflows/debian_package_kanidm.yml | 13 ++++--- .github/workflows/rust_build.yml | 28 +++++++-------- .github/workflows/rust_test.yml | 40 --------------------- .github/workflows/wasm_test.yml | 14 ++++---- .github/workflows/windows_build.yml | 31 ++++++++-------- 6 files changed, 50 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/rust_test.yml diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index b39446091..83b4731ad 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -8,6 +8,9 @@ name: Clippy - master pull_request: +env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,20 +20,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Restore our 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: Update package manager - run: sudo apt-get update + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: Install dependencies run: | + sudo apt-get update && \ sudo apt-get install -y \ libpam0g-dev \ libudev-dev \ diff --git a/.github/workflows/debian_package_kanidm.yml b/.github/workflows/debian_package_kanidm.yml index 7ab727e62..8494147ba 100644 --- a/.github/workflows/debian_package_kanidm.yml +++ b/.github/workflows/debian_package_kanidm.yml @@ -5,6 +5,10 @@ name: "Build Debian Packages" push: pull_request: +env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -27,10 +31,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Update package manager - run: apt-get update - name: Install dependencies run: | + apt-get update && \ apt-get install -y \ lsb-release \ libpam0g-dev \ @@ -43,7 +46,9 @@ jobs: sudo - name: Install Rust uses: dtolnay/rust-toolchain@stable - - name: "Doing the package build" + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: Build packages run: | make -f platform/debian/Makefile debs/all - name: Upload debs @@ -56,7 +61,7 @@ jobs: name: Upload to releases needs: build-deb-package runs-on: ubuntu-latest - if: ${{ github.ref == 'refs/heads/master' }} + if: github.ref == 'refs/heads/master' && github.repository == 'kanidm/kanidm' steps: - name: Download previously built debs uses: actions/download-artifact@v3 diff --git a/.github/workflows/rust_build.yml b/.github/workflows/rust_build.yml index 18c76b2a1..b6e591824 100644 --- a/.github/workflows/rust_build.yml +++ b/.github/workflows/rust_build.yml @@ -1,5 +1,5 @@ --- -name: "Rust Build" +name: "Linux Build and Test" # Trigger the workflow on push to master or pull request "on": push: @@ -7,6 +7,10 @@ name: "Rust Build" - master pull_request: +env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -14,28 +18,20 @@ jobs: rust_build: runs-on: ubuntu-20.04 steps: - - name: Restore our 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') }} - uses: actions/checkout@v3 - - - name: Update package manager - run: sudo apt-get update + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.3 - name: Install dependencies run: | + sudo apt-get update && \ sudo apt-get install -y \ libpam0g-dev \ libudev-dev \ libssl-dev \ libsqlite3-dev - - name: Run build - run: cargo build --verbose --workspace + - run: cargo build --workspace + - run: cargo test diff --git a/.github/workflows/rust_test.yml b/.github/workflows/rust_test.yml deleted file mode 100644 index 11d114c8f..000000000 --- a/.github/workflows/rust_test.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: "Rust Test" - -# Trigger the workflow on push to master or pull request -"on": - push: - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true -jobs: - rust_test: - runs-on: ubuntu-20.04 - steps: - - name: Restore our 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') }} - - uses: actions/checkout@v3 - - - name: Update package manager - run: sudo apt-get update - - - name: Install dependencies - run: | - sudo apt-get install -y \ - libpam0g-dev \ - libudev-dev \ - libssl-dev \ - libsqlite3-dev - - - name: Run tests - run: cargo test --release diff --git a/.github/workflows/wasm_test.yml b/.github/workflows/wasm_test.yml index 4f99c1122..fbeddce48 100644 --- a/.github/workflows/wasm_test.yml +++ b/.github/workflows/wasm_test.yml @@ -4,17 +4,18 @@ name: WASM Testing # Trigger the workflow on push or pull request "on": [push, pull_request] +env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + jobs: wasm_test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - - name: Update package manager - run: sudo apt-get update - - name: Install dependencies run: | + sudo apt-get update && sudo apt-get install -y \ libpam0g-dev \ libudev-dev \ @@ -23,6 +24,8 @@ jobs: pkg-config - name: Install Rust uses: dtolnay/rust-toolchain@stable + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.3 - name: Install wasm-pack run: cargo install wasm-pack @@ -40,6 +43,5 @@ jobs: # docs here: # https://rustwasm.github.io/docs/wasm-bindgen/wasm-bindgen-test/browsers.html - - name: "Run clippy (ignores errors, this is just a check)" - run: wasm-pack test --headless --chrome + - run: wasm-pack test --headless --chrome continue-on-error: true diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index dde7b6077..24aae2a04 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -6,33 +6,30 @@ name: Windows Build and Test # it builds and be able to administer Kanidm from # Windows-land +# Trigger the workflow on push to master or pull request "on": push: + branches: + - master + pull_request: + +env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" jobs: windows_build_kanidm: runs-on: windows-latest steps: - uses: actions/checkout@v3 - - name: ensure openssl and vcpkg is good + - name: Install OpenSSL run: | vcpkg integrate install vcpkg install openssl:x64-windows-static-md - name: Install Rust uses: dtolnay/rust-toolchain@stable - - name: build - # yamllint disable-line rule:line-length - run: cargo build --release -p kanidm_client -p kanidm_tools -p orca -p daemon - windows_test_kanidm: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - name: ensure openssl and vcpkg is good - run: | - vcpkg integrate install - vcpkg install openssl:x64-windows-static-md - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - - name: Run cargo test - # yamllint disable-line rule:line-length - run: cargo test -p kanidm_client -p kanidm_tools -p orca -p daemon -p kanidmd_core + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.3 + - run: cargo build -p kanidm_client -p kanidm_tools -p orca -p daemon + # yamllint disable-line rule:line-length + - run: cargo test -p kanidm_client -p kanidm_tools -p orca -p daemon -p kanidmd_core