mirror of
https://github.com/Byron/gitoxide
synced 2025-10-06 01:52:40 +02:00
This eliminates the piping, tricky parsing, and special-casing to preserve colorization, and runs the tests and the XML parsing in the default `pwsh` shell (since this is a Windows job), using PowerShell facilities to parse the XML. This also checks that there are no *errors*, in addition to (still) checking that there are no more *failures* than expected. In the preceding commit, five additional tests, not currently noted in #1358, failed: FAIL [ 0.010s] gix-credentials::credentials program::from_custom_definition::empty FAIL [ 0.008s] gix-credentials::credentials program::from_custom_definition::name FAIL [ 0.010s] gix-credentials::credentials program::from_custom_definition::name_with_args FAIL [ 0.009s] gix-credentials::credentials program::from_custom_definition::name_with_special_args FAIL [ 0.014s] gix-discover::discover upwards::from_dir_with_dot_dot In addition, one test noted in #1358 does not always fail on CI, because it is a performance test and the CI runner is fast enough so that it usually passes: FAIL [ 181.270s] gix-ref-tests::refs packed::iter::performance Let's see if running the tests more similarly to the way they are run on Windows without `GIX_TEST_IGNORE_ARCHIVES`, i.e. without piping and with the Windows default of `pwsh` as the shell, affects any of those new/CI-specific failures.
246 lines
8.4 KiB
YAML
246 lines
8.4 KiB
YAML
name: ci
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CLICOLOR: 1
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'run-ci/**'
|
|
- '**/run-ci/**'
|
|
tags-ignore:
|
|
- '*'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
pure-rust-build:
|
|
runs-on: ubuntu-latest
|
|
container: debian:buster
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Prerequisites
|
|
run: apt-get update && apt-get install --no-install-recommends -y ca-certificates curl gcc libc-dev # gcc is required as OS abstraction
|
|
- name: install Rust via Rustup
|
|
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal;
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: /github/home/.cargo/bin/cargo install --debug --locked --no-default-features --features max-pure --path .
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Setup dependencies
|
|
run:
|
|
sudo apt-get install -y --no-install-recommends liblzma-dev tree
|
|
- uses: extractions/setup-just@v2
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: nextest
|
|
- name: test
|
|
env:
|
|
CI: true
|
|
GIX_TEST_IGNORE_ARCHIVES: 1
|
|
run: just ci-test
|
|
|
|
test-fast:
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- windows-latest
|
|
- macos-latest
|
|
- ubuntu-latest
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Setup dependencies (macos)
|
|
if: startsWith(matrix.os, 'macos')
|
|
run:
|
|
brew install tree openssl gnu-sed
|
|
- name: "cargo check default features"
|
|
if: startsWith(matrix.os, 'windows')
|
|
run: cargo check --workspace --bins --examples
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: nextest
|
|
- name: "Test (nextest)"
|
|
env:
|
|
GIX_TEST_CREATE_ARCHIVES_EVEN_ON_CI: 1
|
|
run: cargo nextest run --workspace --no-fail-fast
|
|
- name: Doctest
|
|
run: cargo test --workspace --doc --no-fail-fast
|
|
- name: Check that tracked archives are up to date
|
|
run: git diff --exit-code # If this fails, the fix is usually to commit a regenerated archive.
|
|
|
|
test-fixtures-windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: nextest
|
|
- name: "Test (nextest)"
|
|
id: nextest
|
|
env:
|
|
GIX_TEST_IGNORE_ARCHIVES: 1
|
|
run: cargo nextest --profile=with-xml run --workspace --no-fail-fast
|
|
continue-on-error: true
|
|
- name: Check how many tests failed
|
|
if: steps.nextest.outcome == 'failure'
|
|
env:
|
|
# FIXME: Change to 15 after verifying that the last step can fail.
|
|
# See https://github.com/GitoxideLabs/gitoxide/issues/1358.
|
|
EXPECTED_FAILURE_COUNT: 13
|
|
run: |
|
|
[xml]$junit = Get-Content -Path 'target/nextest/with-xml/junit.xml'
|
|
if ($junit.testsuites.errors -ne 0) { exit 1 }
|
|
if ($junit.testsuites.failures -gt $env:EXPECTED_FAILURE_COUNT) { exit 1 }
|
|
|
|
test-32bit:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
target: [ armv7-linux-androideabi ]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: stable
|
|
targets: ${{ matrix.target }}
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cross
|
|
- name: "check"
|
|
run: cross check -p gix --target ${{ matrix.target }}
|
|
- name: "Test (unit)"
|
|
# run high-level unit tests that exercise a lot of code while being pure Rust to ease building test binaries.
|
|
# TODO: figure out why `git` doesn't pick up environment configuration so build scripts fail when using `-p gix`.
|
|
run: cross test -p gix-hashtable --target ${{ matrix.target }}
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: stable
|
|
components: clippy,rustfmt
|
|
- uses: extractions/setup-just@v2
|
|
- name: Run cargo clippy
|
|
run: just clippy -D warnings -A unknown-lints --no-deps
|
|
- name: Run cargo doc
|
|
run: just doc
|
|
- name: Run cargo fmt
|
|
run: cargo fmt --all -- --check
|
|
- name: Run cargo diet
|
|
run: |
|
|
curl -LSfs https://raw.githubusercontent.com/the-lean-crate/cargo-diet/master/ci/install.sh | \
|
|
sh -s -- --git the-lean-crate/cargo-diet --target x86_64-unknown-linux-musl --tag v1.2.4
|
|
|
|
# Let's not fail CI for this, it will fail locally often enough, and a crate a little bigger
|
|
# than allows is no problem either if it comes to that.
|
|
just check-size || true
|
|
|
|
cargo-deny:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
checks:
|
|
- advisories
|
|
- bans licenses sources
|
|
|
|
# Prevent sudden announcement of a new advisory from failing ci:
|
|
continue-on-error: ${{ matrix.checks == 'advisories' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: EmbarkStudios/cargo-deny-action@v2
|
|
with:
|
|
command: check ${{ matrix.checks }}
|
|
|
|
wasm:
|
|
name: WebAssembly
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
strategy:
|
|
matrix:
|
|
target: [ wasm32-unknown-unknown, wasm32-wasi ]
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- name: Install Rust
|
|
run: rustup update stable && rustup default stable && rustup target add ${{ matrix.target }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: set +x; for name in gix-sec; do (cd $name && cargo build --target ${{ matrix.target }}); done
|
|
name: "WASI only: crates without feature toggle"
|
|
if: endsWith(matrix.target, '-wasi')
|
|
- run: set +x; for name in gix-actor gix-attributes gix-bitmap gix-chunk gix-command gix-commitgraph gix-config-value gix-date gix-glob gix-hash gix-hashtable gix-mailmap gix-object gix-packetline gix-path gix-pathspec gix-prompt gix-quote gix-refspec gix-revision gix-traverse gix-url gix-validate; do (cd $name && cargo build --target ${{ matrix.target }}); done
|
|
name: crates without feature toggles
|
|
- run: set +x; for feature in progress fs-walkdir-parallel parallel io-pipe crc32 zlib zlib-rust-backend fast-sha1 rustsha1 cache-efficiency-debug; do (cd gix-features && cargo build --features $feature --target ${{ matrix.target }}); done
|
|
name: features of gix-features
|
|
- run: set +x; for name in gix-pack; do (cd $name && cargo build --features wasm --target ${{ matrix.target }}); done
|
|
name: crates with 'wasm' feature
|
|
- run: cd gix-pack && cargo build --all-features --target ${{ matrix.target }}
|
|
name: gix-pack with all features (including wasm)
|
|
|
|
check-packetline:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
# We consider this script read-only and its effect is the same everywhere.
|
|
# However, when changes are made to `etc/copy-packetline.sh`, re-enable the other platforms for testing.
|
|
# - macos-latest
|
|
# - windows-latest
|
|
runs-on: ${{ matrix.os }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Check that working tree is initially clean
|
|
run: |
|
|
set -x
|
|
git status
|
|
git diff --exit-code
|
|
- name: Regenerate gix-packetline-blocking/src
|
|
run: etc/copy-packetline.sh
|
|
- name: Check that gix-packetline-blocking/src was already up to date
|
|
run: |
|
|
set -x
|
|
git status
|
|
git diff --exit-code
|
|
|
|
# Dummy job to have a stable name for the "all tests pass" requirement
|
|
tests-pass:
|
|
name: Tests pass
|
|
needs:
|
|
- pure-rust-build
|
|
- test
|
|
- test-fast
|
|
- test-32bit
|
|
- lint
|
|
- cargo-deny
|
|
- wasm
|
|
- check-packetline
|
|
if: always() # always run even if dependencies fail
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# fail if ANY dependency has failed or cancelled
|
|
- if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')"
|
|
run: exit 1
|
|
- run: exit 0
|