Better caching in CI (#3127)
* merge nix, better caching * use faster runner for playwright
This commit is contained in:
1 parent
8a0eca1c8a
commit
ebaca480a1
4 files changed
+66
-127
No files matched your search
+65
-57
@@ -37,7 +37,7 @@ concurrency:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_INCREMENTAL: "0"
|
||||
CARGO_INCREMENTAL: "1"
|
||||
RUST_BACKTRACE: 1
|
||||
rust_nightly: nightly-2024-10-20
|
||||
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
# https://github.com/foresterre/cargo-msrv/blob/4345edfe3f4fc91cc8ae6c7d6804c0748fae92ae/.github/workflows/msrv.yml
|
||||
- name: install_cargo_msrv
|
||||
run: cargo install cargo-msrv --all-features
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
- uses: davidB/rust-cargo-make@v1
|
||||
- uses: browser-actions/setup-firefox@latest
|
||||
- uses: jetli/wasm-pack-action@v0.4.0
|
||||
@@ -94,22 +94,22 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
uses: jlumbroso/free-disk-space@v1.3.1
|
||||
with: # speed things up a bit
|
||||
large-packages: false
|
||||
docker-images: false
|
||||
swap-storage: false
|
||||
- run: sudo apt-get update
|
||||
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
- uses: davidB/rust-cargo-make@v1
|
||||
- uses: browser-actions/setup-firefox@latest
|
||||
- uses: jetli/wasm-pack-action@v0.4.0
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
uses: jlumbroso/free-disk-space@v1.3.1
|
||||
with: # speed things up a bit
|
||||
large-packages: false
|
||||
docker-images: false
|
||||
swap-storage: false
|
||||
- run: cargo test --profile release-unoptimized --lib --bins --tests --examples --workspace --exclude dioxus-desktop --exclude dioxus-mobile
|
||||
|
||||
fmt:
|
||||
@@ -124,7 +124,7 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
typos:
|
||||
@@ -151,7 +151,7 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
- name: "doc --lib --all-features"
|
||||
run: |
|
||||
cargo doc --workspace --no-deps --all-features --document-private-items
|
||||
@@ -193,7 +193,7 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
- run: cargo check --workspace --all-features --all-targets
|
||||
|
||||
clippy:
|
||||
@@ -210,40 +210,29 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
- run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings
|
||||
|
||||
# Only run semver checks if the PR is not a draft and does not have the breaking label
|
||||
# Breaking PRs don't need to follow semver since they are breaking changes
|
||||
# However, this means we won't attempt to backport them, so you should be careful about using this label, as it will
|
||||
# likely make future backporting difficult
|
||||
#
|
||||
# todo: fix this so even if breaking changes have been merged, the fix can be backported
|
||||
#
|
||||
# This will stop working once the first breaking change has been merged, so we should really try to just backport the fix
|
||||
# and *then* run the semver checks. Basically "would backporting this PR cause a breaking change on stable?"
|
||||
#
|
||||
# semver:
|
||||
# if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'breaking')
|
||||
# name: Semver Check
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# - uses: dtolnay/rust-toolchain@stable
|
||||
# - uses: Swatinem/rust-cache@v2
|
||||
# with:
|
||||
# cache-all-crates: "true"
|
||||
# save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
# - name: Check semver
|
||||
# uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||
# with:
|
||||
# manifest-path: ./Cargo.toml
|
||||
# exclude: "dioxus-cli, dioxus-ext"
|
||||
nix:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- name: Install omnix
|
||||
run: nix --accept-flake-config profile install "github:juspay/omnix"
|
||||
- name: Build all flake outputs
|
||||
run: om ci
|
||||
- name: Ensure devShell has all build deps
|
||||
run: nix develop -c cargo build -p dioxus-cli
|
||||
|
||||
playwright:
|
||||
if: github.event.pull_request.draft == false
|
||||
name: Playwright Tests
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
# Do our best to cache the toolchain and node install steps
|
||||
- uses: actions/checkout@v4
|
||||
@@ -264,23 +253,15 @@ jobs:
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
working-directory: ./packages/playwright-tests
|
||||
|
||||
- name: Install Playwright
|
||||
run: npm install -D @playwright/test
|
||||
working-directory: ./packages/playwright-tests
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps
|
||||
working-directory: ./packages/playwright-tests
|
||||
|
||||
- name: Run Playwright tests
|
||||
run: npx playwright test
|
||||
- name: Playwright
|
||||
working-directory: ./packages/playwright-tests
|
||||
run: |
|
||||
npm ci
|
||||
npm install -D @playwright/test
|
||||
npx playwright install --with-deps
|
||||
npx playwright test
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
@@ -367,8 +348,35 @@ jobs:
|
||||
with:
|
||||
key: "${{ matrix.platform.target }}"
|
||||
cache-all-crates: "true"
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
cache-on-failure: "true"
|
||||
|
||||
- name: test
|
||||
run: |
|
||||
${{ env.RUST_CARGO_COMMAND }} ${{ matrix.platform.command }} ${{ matrix.platform.args }} --target ${{ matrix.platform.target }}
|
||||
|
||||
# Only run semver checks if the PR is not a draft and does not have the breaking label
|
||||
# Breaking PRs don't need to follow semver since they are breaking changes
|
||||
# However, this means we won't attempt to backport them, so you should be careful about using this label, as it will
|
||||
# likely make future backporting difficult
|
||||
#
|
||||
# todo: fix this so even if breaking changes have been merged, the fix can be backported
|
||||
#
|
||||
# This will stop working once the first breaking change has been merged, so we should really try to just backport the fix
|
||||
# and *then* run the semver checks. Basically "would backporting this PR cause a breaking change on stable?"
|
||||
#
|
||||
# semver:
|
||||
# if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'breaking')
|
||||
# name: Semver Check
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# - uses: dtolnay/rust-toolchain@stable
|
||||
# - uses: Swatinem/rust-cache@v2
|
||||
# with:
|
||||
# cache-all-crates: "true"
|
||||
# cache-on-failure: "true"
|
||||
# - name: Check semver
|
||||
# uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||
# with:
|
||||
# manifest-path: ./Cargo.toml
|
||||
# exclude: "dioxus-cli, dioxus-ext"
|
||||
@@ -1,43 +0,0 @@
|
||||
name: "Nix CI"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- packages/**
|
||||
- examples/**
|
||||
- docs/guide/**
|
||||
- src/**
|
||||
- .github/**
|
||||
- lib.rs
|
||||
- Cargo.toml
|
||||
- Makefile.toml
|
||||
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- packages/**
|
||||
- examples/**
|
||||
- src/**
|
||||
- .github/**
|
||||
- lib.rs
|
||||
- Cargo.toml
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- name: Install omnix
|
||||
run: nix --accept-flake-config profile install "github:juspay/omnix"
|
||||
- name: Build all flake outputs
|
||||
run: om ci
|
||||
- name: Ensure devShell has all build deps
|
||||
run: nix develop -c cargo build -p dioxus-cli
|
||||
Reference in new issue
Block a user