Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Sync up github workflow with my other projects
Browse files Browse the repository at this point in the history
  • Loading branch information
HadrienG2 committed Nov 16, 2023
1 parent b19a455 commit 575ebe6
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,33 @@
# minimal supported Rust version and the current stable Rust version.
# - Two times a month, a scheduled job makes sure that the code remains
# compatible and lint-free on upcoming Rust toolchains (beta and nightly).
#
# The Cargo registry and index are not cached because they are not used for this
# tiny crate, which has no dependencies.
#
# No caching of Rust toolchains or target directories is performed on unstable
# runs, since those runs are rare and the caches would be invalidated inbetween
# two of them (especially for nightly toolchains).

name: Continuous Integration

on:
push:
pull_request:
schedule:
- cron: '0 0 1,15 * *'
- cron: '0 0 10/15 * *'

name: Continuous Integration
# Cancel existing jobs on new pushes to the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
MINIMAL_RUST: 1.63.0 # Minimal Supported Rust Version

jobs:
# Formatter output and lints don't depend on the operating system, and only
# need to be tested on the latest supported release of each CI run.
check:
# Only run on "pull_request" event for external PRs. This is to avoid
# duplicate builds for PRs created from internal branches.
# Format doesn't depend on configuration, and lints don't depend on the
# operating system since there's no OS-specific code path in this crate.
#
# We don't care about warnings on the minimum supported Rust version, only
# about building and running correctly.
format-lints:
# Don't run CI twice when a PR is created from a branch internal to the repo
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ubuntu-latest
Expand All @@ -51,13 +53,10 @@ jobs:
components: rustfmt,clippy

- name: Check format
uses: actions-rust-lang/rustfmt@v1

- name: Type-check the program
run: cargo check
run: cargo fmt --all --check

- name: Check clippy lints
run: cargo clippy -- -D warnings
run: cargo clippy --workspace --all-targets -- -D warnings

- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
Expand All @@ -67,8 +66,8 @@ jobs:

# Run the tests on all supported OSes and stable Rust versions (main CI)
test-contrib:
# Only run on "pull_request" event for external PRs. This is to avoid
# duplicate builds for PRs created from internal branches.
# Don't run CI twice when a PR is created from a branch internal to the repo
# Don't run in scheduled jobs, that's what test-scheduled is for
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ${{ matrix.os }}
Expand All @@ -81,7 +80,7 @@ jobs:
- macos-latest
rust:
- stable
- 1.63.0 # Minimum supported Rust version
- $MINIMAL_RUST # Minimum supported Rust version

steps:
- name: Checkout sources
Expand All @@ -95,7 +94,7 @@ jobs:
- name: Run basic tests
run: cargo test

- name: Run concurrent tests and benchmarks
- name: Run concurrent tests
run: cargo test --release -- --ignored --nocapture --test-threads=1


Expand All @@ -118,7 +117,7 @@ jobs:
rust:
- beta
- nightly
- 1.63.0 # Minimum supported Rust version (can be changed by deps)
- $MINIMAL_RUST # Compatibility can be broken by deps updates

steps:
- name: Checkout sources
Expand All @@ -132,5 +131,5 @@ jobs:
- name: Run basic tests
run: cargo test

- name: Run concurrent tests and benchmarks
- name: Run concurrent tests
run: cargo test --release -- --ignored --nocapture --test-threads=1

0 comments on commit 575ebe6

Please sign in to comment.