Skip to content

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.

ci: Cache Rust builds and merge pr.yml jobs (#1670)

Amaury14e48ba73347
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 3f236408..4b8ead65 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -14,7 +14,8 @@ env:
SQLX_OFFLINE: true
jobs:
- # Cargo check.
+ # Cargo fmt, clippy and test, in a single job so they share one Rust cache.
+ # Clippy also covers what `cargo check` used to.
check:
runs-on: ubuntu-latest
steps:
@@ -27,47 +28,12 @@ jobs:
profile: minimal
toolchain: stable
override: true
+ components: rustfmt, clippy
- - name: Run cargo check
- uses: actions-rs/cargo@v1
- with:
- command: check
- args: --all
-
- # Cargo test.
- test:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout sources
- uses: actions/checkout@v2
-
- - name: Install stable toolchain
- uses: actions-rs/toolchain@v1
- with:
- profile: minimal
- toolchain: stable
- override: true
-
- - name: Run cargo test
- uses: actions-rs/cargo@v1
- with:
- command: test
- args: --all
-
- # Cargo fmt and clippy
- lints:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout sources
- uses: actions/checkout@v2
-
- - name: Install stable toolchain
- uses: actions-rs/toolchain@v1
+ - uses: Swatinem/rust-cache@v2
with:
- profile: minimal
- toolchain: stable
- override: true
- components: rustfmt, clippy
+ # Only save caches from master, so PRs don't evict each other.
+ save-if: ${{ github.ref == 'refs/heads/master' }}
- name: Run cargo fmt
uses: actions-rs/cargo@v1
@@ -80,3 +46,9 @@ jobs:
with:
command: clippy
args: --all -- -A deprecated
+
+ - name: Run cargo test
+ uses: actions-rs/cargo@v1
+ with:
+ command: test
+ args: --all
diff --git a/.github/workflows/pr_cli.yml b/.github/workflows/pr_cli.yml
index 7fce4ea6..2eef6054 100644
--- a/.github/workflows/pr_cli.yml
+++ b/.github/workflows/pr_cli.yml
@@ -46,6 +46,11 @@ jobs:
- run: chmod +x /usr/local/bin/cross
- run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }}
+ - uses: Swatinem/rust-cache@v2
+ with:
+ key: ${{ matrix.target }}
+ # Only save caches from master, so PRs don't evict each other.
+ save-if: ${{ github.ref == 'refs/heads/master' }}
- run: ci/build.bash cross ${{ matrix.target }}
# Only test on macOS platforms since we can't simulate the others.
- run: ci/test.bash cross ${{ matrix.target }}
@@ -99,6 +104,11 @@ jobs:
path: /tmp/
- run: chmod +x /tmp/cross
- run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }}
+ - uses: Swatinem/rust-cache@v2
+ with:
+ key: ${{ matrix.target }}
+ # Only save caches from master, so PRs don't evict each other.
+ save-if: ${{ github.ref == 'refs/heads/master' }}
- run: ci/build.bash /tmp/cross ${{ matrix.target }}
# These targets have issues with being tested so they are disabled
# by default. You can try disabling to see if they work for