Skip to content

Commit

Permalink
Improve GitHub Actions CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Jan 18, 2024
1 parent a383063 commit 9ff6d0d
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: CI
on:
push:
branches-ignore: [master]
branches:
- auto-cargo
- try
- automation/bors/try
- "rust-**"
pull_request:
branches: ['*']
branches:
- "**"

defaults:
run:
Expand All @@ -12,6 +17,10 @@ defaults:
permissions:
contents: read

concurrency:
group: "${{ github.workflow }}-${{ (github.ref == 'refs/heads/try' && github.sha) || github.ref }}"
cancel-in-progress: true

jobs:
success:
permissions:
Expand Down Expand Up @@ -53,17 +62,23 @@ jobs:
# Check Code style quickly by running `rustfmt` over all code
rustfmt:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup update stable && rustup default stable
- run: rustup component add rustfmt
- run: cargo fmt --all --check

# Ensure there are no clippy warnings
clippy:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup update stable && rustup default stable
- run: rustup component add clippy
- run: cargo clippy --workspace --all-targets --no-deps -- -D warnings
Expand All @@ -72,19 +87,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup update stable && rustup default stable
- run: cargo stale-label

# Ensure Cargo.lock is up-to-date
lockfile:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup update stable && rustup default stable
- run: cargo update -p cargo --locked

check-version-bump:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
Expand All @@ -108,6 +129,7 @@ jobs:
CARGO_PROFILE_TEST_DEBUG: 1
CARGO_INCREMENTAL: 0
CARGO_PUBLIC_NETWORK_TESTS: 1
if: "github.repository == 'rust-lang/cargo'"
strategy:
matrix:
include:
Expand Down Expand Up @@ -142,6 +164,8 @@ jobs:
name: Tests ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Dump Environment
run: ci/dump-environment.sh
- run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
Expand Down Expand Up @@ -191,15 +215,21 @@ jobs:

resolver:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup update stable && rustup default stable
- run: cargo test -p resolver-tests

test_gitoxide:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add i686-unknown-linux-gnu
- run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y
Expand All @@ -210,8 +240,11 @@ jobs:

build_std:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup update nightly && rustup default nightly
- run: rustup component add rust-src
- run: cargo build
Expand All @@ -220,8 +253,11 @@ jobs:
CARGO_RUN_BUILD_STD_TESTS: 1
docs:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup update nightly && rustup default nightly
- run: rustup update stable
- run: rustup component add rust-docs
Expand All @@ -247,7 +283,10 @@ jobs:
msrv:
runs-on: ubuntu-latest
if: "github.repository == 'rust-lang/cargo'"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: taiki-e/install-action@cargo-hack
- run: cargo hack check --all-targets --rust-version --workspace --ignore-private

0 comments on commit 9ff6d0d

Please sign in to comment.