Skip to content

Commit 381286d

Browse files
committed
ci: fetch purl-spec submodule for cargo test
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent d7a8822 commit 381286d

File tree

3 files changed

+76
-13
lines changed

3 files changed

+76
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,82 @@ permissions:
1919

2020
jobs:
2121

22-
common:
23-
uses: scm-rs/shared-workflows/.github/workflows/ci.yaml@main
22+
msrv:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
rust-version: ${{ steps.get-version.outputs.rust-version }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
- name: Extract version
31+
id: get-version
32+
run: |
33+
MSRV=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].rust_version')
34+
echo "rust-version=$MSRV" >> $GITHUB_OUTPUT
35+
- name: Show version
36+
run: |
37+
echo "MSRV: ${{ steps.get-version.outputs.rust-version }}"
2438
25-
ci:
39+
preflight:
2640
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
submodules: true
45+
- uses: webiny/action-conventional-commits@v1.3.0
46+
47+
- uses: Swatinem/rust-cache@v2
48+
- uses: obi1kenobi/cargo-semver-checks-action@v2
49+
50+
- name: Check formatting
51+
run: cargo fmt --check
52+
53+
check:
2754
needs:
28-
- common
29-
if: always()
55+
- msrv
56+
- preflight
57+
strategy:
58+
matrix:
59+
rust:
60+
- stable
61+
- ${{ needs.msrv.outputs.rust-version }}
62+
os:
63+
- ubuntu-22.04
64+
- windows-2022
65+
- macos-14
66+
runs-on: ${{ matrix.os }}
3067
steps:
31-
- name: Success
32-
if: ${{ !(contains(needs.*.result, 'failure')) }}
33-
run: exit 0
34-
- name: Failure
35-
if: ${{ contains(needs.*.result, 'failure') }}
36-
run: exit 1
68+
- name: Dump matrix config
69+
run: echo "${{ toJSON(matrix) }}"
70+
71+
- uses: actions/checkout@v4
72+
with:
73+
submodules: true
74+
- uses: Swatinem/rust-cache@v2
75+
76+
- name: Install Rust ${{ matrix.rust }}
77+
run: rustup install ${{ matrix.rust }} --no-self-update --component clippy
78+
79+
- name: Tree
80+
run: cargo +${{ matrix.rust }} tree
81+
82+
- name: Clippy
83+
run: cargo +${{ matrix.rust }} clippy --all-targets --tests --bins --all -- -D warnings
84+
85+
- name: Test
86+
run: cargo +${{ matrix.rust }} test
87+
88+
- name: Install binstall
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
run: |
92+
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
93+
94+
- name: Install cargo-all-features
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
run: cargo binstall -y cargo-all-features --force
98+
99+
- name: Check (all features)
100+
run: cargo check-all-features

tests/spec/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub fn run_tests_from_spec(path: &Path) {
129129
}
130130
}
131131

132-
#[macro_export]
132+
133133
macro_rules! generate_json_tests {
134134
($($test_name:ident => $file_path:expr),* $(,)?) => {
135135
$(

tests/spec/testcase.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub enum PurlOrString<'a> {
1212

1313

1414
#[derive(Deserialize)]
15-
#[allow(dead_code)]
1615
pub struct PurlComponents<'a> {
1716
#[serde(rename = "type")]
1817
pub ty: Option<Cow<'a, str>>,

0 commit comments

Comments
 (0)