Skip to content

Commit

Permalink
ci: Split jobs, skip matrix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-arts committed Oct 2, 2024
1 parent 66be8e1 commit bc68b52
Show file tree
Hide file tree
Showing 2 changed files with 649 additions and 463 deletions.
188 changes: 188 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
RUST_LOG: info
RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
CARGO_TERM_COLOR: always
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
XDG_CACHE_HOME: ${{ github.workspace }}/.cache

jobs:
lint:
name: Lint & format rust code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy

- name: Run rustfmt
uses: actions-rust-lang/rustfmt@v1

- uses: Swatinem/rust-cache@v2
with:
save-if: false
- name: Run clippy
run: cargo clippy --all-targets --workspace

# Checks for dependencies that are not used in the codebase
cargo-machete:
name: Cargo Machete
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Machete
uses: bnjbvr/cargo-machete@main


cargo-test-linux:
timeout-minutes: 10
name: cargo test on Linux
runs-on: "${{ contains(github.event.pull_request.labels.*.name, 'ci:free') && 'ubuntu-latest' || '8core_ubuntu_latest_runner' }}"
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: rui314/setup-mold@v1
- name: Show version information (Rust, cargo, GCC)
shell: bash
run: |
gcc --version || true
rustup -V
rustup show
cargo -V
rustc -V
- name: "Install cargo nextest"
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest

- name: "Cargo nextest"
run: >-
cargo nextest run
--workspace
--retries 2
--no-default-features --features rustls-tls --features slow_integration_tests
--status-level skip --failure-output immediate-final --no-fail-fast --final-status-level slow
cargo-test-windows:
timeout-minutes: 10
name: cargo test on Windows
runs-on: "${{ contains(github.event.pull_request.labels.*.name, 'ci:free') && 'windows-latest' || '16core_windows_latest_runner' }}"
if: ${{ (github.event_name != 'pull_request') || contains(github.event.pull_request.labels.*.name, 'ci:all') }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: rui314/setup-mold@v1
- name: Show version information (Rust, cargo, MSVC)
shell: bash
run: |
rustup -V
rustup show
cargo -V
rustc -V
rustc -vV || true
- name: "Install cargo nextest"
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest

- name: "Cargo nextest"
run: >-
cargo nextest run
--workspace
--retries 2
--no-default-features --features rustls-tls --features slow_integration_tests
--status-level skip --failure-output immediate-final --no-fail-fast --final-status-level slow
cargo-test-macos:
timeout-minutes: 10
name: cargo test on macOS
runs-on: 'macos-latest'
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: rui314/setup-mold@v1
- name: Show version information (Rust, cargo, clang)
shell: bash
run: |
clang --version || true
rustup -V
rustup show
cargo -V
rustc -V
- name: "Install cargo nextest"
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest

- name: "Cargo nextest"
run: >-
cargo nextest run
--workspace
--retries 2
--no-default-features --features rustls-tls --features slow_integration_tests
--status-level skip --failure-output immediate-final --no-fail-fast --final-status-level slow
build-linux:
name: Build on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2

- name: "Build"
run: cargo build --locked --target x86_64-unknown-linux-musl --profile dist

- name: "Upload binary"
uses: actions/upload-artifact@v4
with:
name: pixi-linux-${{ github.sha }}
path: ./target/x86_64-unknown-linux-musl/debug/pixi
retention-days: 1

# TODO: Add build-windows and build-macos jobs


# TODO: Add Downstream tests jobs


# TODO: Create a release workflow

rustdoc-links:
name: Check intra-doc links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: Swatinem/rust-cache@v2
with:
save-if: false

- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: |
for package in $(cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | .name'); do
cargo rustdoc -p "$package" --all-features -- -D warnings -W unreachable-pub
done
Loading

0 comments on commit bc68b52

Please sign in to comment.