Skip to content

Commit d6feda9

Browse files
Copilotnyurik
andcommitted
Add ci-env-info recipe; slim CI to AVX bug test only
Co-authored-by: nyurik <1641515+nyurik@users.noreply.github.com>
1 parent 3336e81 commit d6feda9

2 files changed

Lines changed: 24 additions & 119 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
matrix:
2121
include:
2222
- os: ubuntu-latest
23-
- os: macos-latest
2423
steps:
2524
- uses: actions/checkout@v6
2625
with: { submodules: recursive }
@@ -29,120 +28,3 @@ jobs:
2928
- uses: taiki-e/install-action@v2
3029
with: { tool: 'just,cargo-binstall' }
3130
- run: just ci-test
32-
33-
test-nightly:
34-
name: Nightly-specific tests
35-
runs-on: ubuntu-latest
36-
steps:
37-
- uses: actions/checkout@v6
38-
with: { submodules: recursive }
39-
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
40-
uses: Swatinem/rust-cache@v2
41-
- uses: taiki-e/install-action@v2
42-
with: { tool: 'just' }
43-
- run: rustup install nightly --profile minimal
44-
- run: just test-publish
45-
46-
test-msrv:
47-
name: Test MSRV
48-
runs-on: ubuntu-latest
49-
steps:
50-
- uses: actions/checkout@v6
51-
with: { submodules: recursive }
52-
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
53-
uses: Swatinem/rust-cache@v2
54-
- uses: taiki-e/install-action@v2
55-
with: { tool: 'just' }
56-
- name: Read MSRV
57-
id: msrv
58-
run: echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT
59-
- name: Install MSRV Rust ${{ steps.msrv.outputs.value }}
60-
uses: dtolnay/rust-toolchain@stable
61-
with:
62-
toolchain: ${{ steps.msrv.outputs.value }}
63-
components: rustfmt
64-
- run: just ci_mode=0 ci-test-msrv # Ignore warnings in MSRV
65-
fuzz:
66-
name: Fuzz
67-
runs-on: ubuntu-latest
68-
69-
env:
70-
# The number of seconds to run the fuzz target.
71-
FUZZ_TIME: 60
72-
73-
strategy:
74-
matrix:
75-
include:
76-
- fuzz_target: cpp_roundtrip
77-
- fuzz_target: rust_compress_oracle
78-
- fuzz_target: rust_decompress_oracle
79-
80-
steps:
81-
- uses: actions/checkout@v6
82-
with: {persist-credentials: false, submodules: recursive}
83-
84-
# Install the nightly Rust channel.
85-
- run: rustup toolchain install nightly
86-
- run: rustup default nightly
87-
88-
# Install and cache `cargo-fuzz`.
89-
- uses: taiki-e/install-action@v2
90-
with:
91-
tool: cargo-binstall
92-
- run: cargo binstall -y cargo-fuzz@0.13.1 # Pinned to avoid breakage.
93-
94-
# Build and then run the fuzz target.
95-
# --target x86_64-unknown-linux-gnu is necessary to not default to musl, which is not supported by cargo-fuzz.
96-
- run: cargo fuzz build --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }}
97-
- run: cargo fuzz run --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }}
98-
99-
# Upload fuzzing artifacts on failure for post-mortem debugging.
100-
- uses: actions/upload-artifact@v6
101-
if: failure()
102-
with:
103-
name: fuzzing-artifacts-${{ matrix.fuzz_target }}-${{ github.sha }}
104-
path: fuzz/artifacts
105-
106-
coverage:
107-
name: Code Coverage
108-
if: github.event_name != 'release'
109-
runs-on: ubuntu-latest
110-
steps:
111-
- uses: actions/checkout@v6
112-
with: { submodules: recursive }
113-
- uses: Swatinem/rust-cache@v2
114-
- uses: taiki-e/install-action@v2
115-
with: { tool: 'just,cargo-llvm-cov' }
116-
- name: Generate code coverage
117-
run: just ci-coverage
118-
- name: Upload coverage to Codecov
119-
uses: codecov/codecov-action@v5
120-
with:
121-
token: ${{ secrets.CODECOV_TOKEN }}
122-
files: target/llvm-cov/codecov.info
123-
124-
# This job checks if any of the previous jobs failed or were canceled.
125-
# This approach also allows some jobs to be skipped if they are not needed.
126-
ci-passed:
127-
needs: [ test, test-nightly, test-msrv, fuzz ]
128-
if: always()
129-
runs-on: ubuntu-latest
130-
steps:
131-
- name: Result of the needed steps
132-
run: echo "${{ toJSON(needs) }}"
133-
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
134-
run: exit 1
135-
136-
release:
137-
# Some dependencies of the `ci-passed` job might be skipped, but we still want to run if the `ci-passed` job succeeded.
138-
if: always() && startsWith(github.ref, 'refs/tags/') && needs.ci-passed.result == 'success'
139-
name: Publish to crates.io
140-
needs: [ ci-passed ]
141-
runs-on: ubuntu-latest
142-
steps:
143-
- uses: actions/checkout@v6
144-
with: { submodules: recursive }
145-
- name: Publish to crates.io
146-
run: cargo publish
147-
env:
148-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

justfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
main_crate := 'fastpfor'
44
features_flag := '--all-features'
5+
just := just_executable()
56

67
# if running in CI, treat warnings as errors by setting RUSTFLAGS and RUSTDOCFLAGS to '-D warnings' unless they are already set
78
# Use `CI=true just ci-test` to run the same tests as in GitHub CI.
@@ -36,7 +37,7 @@ ci-coverage: env-info && \
3637
mkdir -p target/llvm-cov
3738

3839
# Run all tests as expected by CI
39-
ci-test: env-info test-fmt build clippy test test-doc && assert-git-is-clean
40+
ci-test: ci-env-info test-fmt build clippy test test-doc && assert-git-is-clean
4041

4142
# Run minimal subset of tests to ensure compatibility with MSRV
4243
ci-test-msrv: env-info test
@@ -70,6 +71,28 @@ env-info:
7071
@echo "RUSTDOCFLAGS='$RUSTDOCFLAGS'"
7172
@echo "RUST_BACKTRACE='$RUST_BACKTRACE'"
7273

74+
# Print detailed CI environment info including CPU details (Linux-only)
75+
ci-env-info:
76+
@echo "::group::General environment Information"
77+
@echo "Running for '{{main_crate}}' crate {{if ci_mode == '1' {'in CI mode'} else {'in dev mode'} }} on {{os()}} / {{arch()}}"
78+
@echo "PWD {{justfile_directory()}}"
79+
{{just}} --version
80+
rustc --version
81+
cargo --version
82+
rustup --version
83+
@echo "RUSTFLAGS='$RUSTFLAGS'"
84+
@echo "RUSTDOCFLAGS='$RUSTDOCFLAGS'"
85+
@echo "RUST_BACKTRACE='$RUST_BACKTRACE'"
86+
@echo "::endgroup::"
87+
88+
@echo "::group::lscpu"
89+
lscpu
90+
@echo "::endgroup::"
91+
92+
@echo "::group::/proc/cpuinfo"
93+
cat /proc/cpuinfo
94+
@echo "::endgroup::"
95+
7396
# Reformat all code `cargo fmt`. If nightly is available, use it for better results
7497
fmt:
7598
#!/usr/bin/env bash

0 commit comments

Comments
 (0)