From 54ce7410d253fb4a25adf65d1ae73801f29b0e11 Mon Sep 17 00:00:00 2001 From: Tpt Date: Wed, 4 Jan 2023 21:40:08 +0100 Subject: [PATCH] CI: Adds dependency caching --- .github/workflows/artifacts.yml | 26 +++++++++++++++++++++--- .github/workflows/tests.yml | 36 +++++++++++++++++++++++++-------- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml index ba7e034c..e2912846 100644 --- a/.github/workflows/artifacts.yml +++ b/.github/workflows/artifacts.yml @@ -16,6 +16,8 @@ jobs: - uses: actions/checkout@v3 with: submodules: true + - run: rustup update + - uses: Swatinem/rust-cache@v2 - run: cargo build --release working-directory: ./server - uses: actions/upload-artifact@v3 @@ -34,6 +36,7 @@ jobs: with: submodules: true - run: rustup update + - uses: Swatinem/rust-cache@v2 - run: cargo build --release working-directory: ./server - uses: actions/upload-artifact@v3 @@ -48,6 +51,7 @@ jobs: with: submodules: true - run: rustup update + - uses: Swatinem/rust-cache@v2 - run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse - run: cargo build --release working-directory: ./server @@ -62,6 +66,8 @@ jobs: - uses: actions/checkout@v3 with: submodules: true + - run: rustup update + - uses: Swatinem/rust-cache@v2 - run: sed 's/%arch%/x86_64/g' .github/workflows/manylinux_build.sh | sed 's/%for_each_version%//g' > .github/workflows/manylinux_build_script.sh - run: docker run -v "$(pwd)":/workdir --platform linux/x86_64 quay.io/pypa/manylinux2014_x86_64 /bin/bash /workdir/.github/workflows/manylinux_build_script.sh - uses: actions/upload-artifact@v3 @@ -79,10 +85,13 @@ jobs: - uses: actions/checkout@v3 with: submodules: true + - run: rustup update && rustup target add aarch64-apple-darwin + - uses: Swatinem/rust-cache@v2 - uses: actions/setup-python@v4 with: python-version: "3.10" - - run: rustup update && rustup target add aarch64-apple-darwin + cache: pip + cache-dependency-path: '**/requirements.dev.txt' - run: pip install -r python/requirements.dev.txt - run: maturin build --release -m python/Cargo.toml - run: pip install --no-index --find-links=target/wheels/ pyoxigraph @@ -101,10 +110,13 @@ jobs: - uses: actions/checkout@v3 with: submodules: true + - run: rustup update + - uses: Swatinem/rust-cache@v2 - uses: actions/setup-python@v4 with: python-version: "3.10" - - run: rustup update + cache: pip + cache-dependency-path: '**/requirements.dev.txt' - run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse - run: pip install -r python/requirements.dev.txt - run: maturin build --release -m python/Cargo.toml @@ -122,8 +134,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: true - run: rustup update - - run: cargo install wasm-pack + - uses: Swatinem/rust-cache@v2 + - run: cargo install wasm-pack || true + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + cache-dependency-path: "js/package.json" - run: npm run pack working-directory: ./js - uses: actions/upload-artifact@v3 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d15dad13..c461cf32 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ on: branches: - main schedule: - - cron: "0 0 * * 0" + - cron: "12 3 * * *" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -26,6 +26,7 @@ jobs: with: submodules: true - run: rustup update && rustup component add clippy + - uses: Swatinem/rust-cache@v2 - run: cargo clippy working-directory: ./lib/oxsdatatypes - run: cargo clippy @@ -42,7 +43,8 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - run: rustup override set 1.60.0 && rustup component add clippy + - run: rustup update && rustup override set 1.60.0 && rustup component add clippy + - uses: Swatinem/rust-cache@v2 - run: cargo clippy -- -D warnings -D clippy::all working-directory: ./lib/oxsdatatypes - run: cargo clippy -- -D warnings -D clippy::all @@ -67,6 +69,7 @@ jobs: with: submodules: true - run: rustup update + - uses: Swatinem/rust-cache@v2 - run: cargo test --all-features env: RUST_BACKTRACE: 1 @@ -77,8 +80,9 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - run: rustup update && rustup toolchain install nightly - - run: cargo +nightly test --tests --target x86_64-unknown-linux-gnu --workspace --exclude pyoxigraph --exclude oxigraph_testsuite --exclude oxigraph_server + - run: rustup update && rustup override set nightly + - uses: Swatinem/rust-cache@v2 + - run: cargo test --tests --target x86_64-unknown-linux-gnu --workspace --exclude pyoxigraph --exclude oxigraph_testsuite --exclude oxigraph_server env: RUST_BACKTRACE: 1 RUSTFLAGS: -Z sanitizer=address @@ -90,6 +94,7 @@ jobs: with: submodules: true - run: rustup update + - uses: Swatinem/rust-cache@v2 - run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse - run: cargo test --all-features env: @@ -100,7 +105,13 @@ jobs: steps: - uses: actions/checkout@v3 - run: rustup update - - run: cargo install wasm-pack + - uses: Swatinem/rust-cache@v2 + - run: cargo install wasm-pack || true + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + cache-dependency-path: "js/package.json" - run: npm install working-directory: ./js - run: npm test @@ -113,14 +124,18 @@ jobs: with: submodules: true - run: rustup update + - uses: Swatinem/rust-cache@v2 - uses: actions/setup-python@v4 with: python-version: "3.10" + cache: pip + cache-dependency-path: '**/requirements.dev.txt' - run: pip install -r python/requirements.dev.txt - run: python -m black --check --diff --color . working-directory: ./python - - run: maturin sdist -m python/Cargo.toml - - run: pip install target/wheels/*.tar.gz + - run: maturin build -m python/Cargo.toml + - run: pip install --no-index --find-links=target/wheels/ pyoxigraph + - run: rm -r target/wheels - run: python -m unittest working-directory: ./python/tests - run: sphinx-build -M doctest . build @@ -141,11 +156,16 @@ jobs: with: submodules: true - run: rustup update + - uses: Swatinem/rust-cache@v2 - uses: actions/setup-python@v4 with: python-version: "3.7" + cache: pip + cache-dependency-path: '**/requirements.dev.txt' - run: pip install -r python/requirements.dev.txt - - run: pip install ./python + - run: maturin build -m python/Cargo.toml + - run: pip install --no-index --find-links=target/wheels/ pyoxigraph + - run: rm -r target/wheels - run: python -m unittest working-directory: ./python/tests