Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caching to CI pipeline #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/audits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
key: ${{ runner.os }}-cargo-vet

- uses: actions-rs/toolchain@v1
with:
Expand Down
104 changes: 100 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-dependencies-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-dependencies
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.59.0
Expand All @@ -30,6 +41,11 @@ jobs:
with:
command: test
args: --all --verbose --exclude rage --all-features
- name: Autoclean the cache
if: steps.cargo-cache.outputs.cache-hit != 'true'
run:
cargo install --no-default-features --features ci-autoclean cargo-cache
cargo-cache

build:
name: Build target ${{ matrix.target }}
Expand All @@ -41,6 +57,17 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-dependencies-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-dependencies
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.59.0
Expand All @@ -54,13 +81,29 @@ jobs:
- name: Build for target
working-directory: ./age
run: cargo build --verbose --no-default-features --target ${{ matrix.target }}
- name: Autoclean the cache
if: steps.cargo-cache.outputs.cache-hit != 'true'
run:
cargo install --no-default-features --features ci-autoclean cargo-cache
cargo-cache

bitrot:
name: Bitrot
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-dependencies-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-dependencies
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.59.0
Expand All @@ -72,13 +115,29 @@ jobs:
with:
command: check
args: --tests --examples --benches --all-features
- name: Autoclean the cache
if: steps.cargo-cache.outputs.cache-hit != 'true'
run:
cargo install --no-default-features --features ci-autoclean cargo-cache
cargo-cache

clippy:
name: Clippy (1.59.0)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-dependencies-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-dependencies
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.59.0
Expand All @@ -92,13 +151,29 @@ jobs:
name: Clippy (1.59.0)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
- name: Autoclean the cache
if: steps.cargo-cache.outputs.cache-hit != 'true'
run:
cargo install --no-default-features --features ci-autoclean cargo-cache
cargo-cache

codecov:
name: Code coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-dependencies-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-dependencies
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -110,17 +185,32 @@ jobs:
with:
version: '0.19.1'
args: --workspace --release --all-features --timeout 180 --out Xml
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
fail_ci_if_error: true
# - name: Upload coverage to Codecov
# uses: codecov/[email protected]
# with:
# fail_ci_if_error: true
- name: Autoclean the cache
if: steps.cargo-cache.outputs.cache-hit != 'true'
run:
cargo install --no-default-features --features ci-autoclean cargo-cache
cargo-cache

doc-links:
name: Intra-doc links
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-dependencies-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-dependencies
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.59.0
Expand All @@ -137,6 +227,12 @@ jobs:
with:
command: doc
args: --all --exclude rage --all-features --document-private-items
- name: Autoclean the cache
if: steps.cargo-cache.outputs.cache-hit != 'true'
run:
cargo install --no-default-features --features ci-autoclean cargo-cache
cargo-cache


fmt:
name: Rustfmt
Expand Down