Debian Codegraph @

.github/workflows/test.yml

raw symbols SCIP
1 # This is the main CI workflow that runs the test suite on all pushes to main and all pull requests.
2 # It runs the following jobs:
3 # - required: runs the test suite on ubuntu with stable and beta rust toolchains
4 # - minimal: runs the test suite with the minimal versions of the dependencies that satisfy the
5 # requirements of this crate, and its dependencies
6 # - os-check: runs the test suite on mac and windows
7 # - coverage: runs the test suite and collects coverage information
8 # See check.yml for information about how the concurrency cancellation and workflow triggering works
9 permissions:
10 contents: read
11 on:
12 push:
13 branches: [main]
14 pull_request:
15 concurrency:
16 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17 cancel-in-progress: true
18 name: test
19 jobs:
20 required:
21 runs-on: ubuntu-latest
22 name: ubuntu / ${{ matrix.toolchain }}
23 strategy:
24 matrix:
25 # run on stable and beta to ensure that tests won't break on the next version of the rust
26 # toolchain
27 toolchain: [stable, beta]
28 steps:
29 - uses: actions/checkout@v4
30 with:
31 submodules: true
32 - name: Install ${{ matrix.toolchain }}
33 uses: dtolnay/rust-toolchain@master
34 with:
35 toolchain: ${{ matrix.toolchain }}
36 - name: cargo generate-lockfile
37 # enable this ci template to run regardless of whether the lockfile is checked in or not
38 if: hashFiles('Cargo.lock') == ''
39 run: cargo generate-lockfile
40 # https://twitter.com/jonhoo/status/1571290371124260865
41 - name: cargo test --locked
42 run: cargo test --locked --all-features --all-targets
43 # https://github.com/rust-lang/cargo/issues/6669
44 - name: cargo test --doc
45 run: cargo test --locked --all-features --doc
46 minimal:
47 # This action chooses the oldest version of the dependencies permitted by Cargo.toml to ensure
48 # that this crate is compatible with the minimal version that this crate and its dependencies
49 # require. This will pickup issues where this create relies on functionality that was introduced
50 # later than the actual version specified (e.g., when we choose just a major version, but a
51 # method was added after this version).
52 #
53 # This particular check can be difficult to get to succeed as often transitive dependencies may
54 # be incorrectly specified (e.g., a dependency specifies 1.0 but really requires 1.1.5). There
55 # is an alternative flag available -Zdirect-minimal-versions that uses the minimal versions for
56 # direct dependencies of this crate, while selecting the maximal versions for the transitive
57 # dependencies. Alternatively, you can add a line in your Cargo.toml to artificially increase
58 # the minimal dependency, which you do with e.g.:
59 # ```toml
60 # # for minimal-versions
61 # [target.'cfg(any())'.dependencies]
62 # openssl = { version = "0.10.55", optional = true } # needed to allow foo to build with -Zminimal-versions
63 # ```
64 # The optional = true is necessary in case that dependency isn't otherwise transitively required
65 # by your library, and the target bit is so that this dependency edge never actually affects
66 # Cargo build order. See also
67 # https://github.com/jonhoo/fantoccini/blob/fde336472b712bc7ebf5b4e772023a7ba71b2262/Cargo.toml#L47-L49.
68 # This action is run on ubuntu with the stable toolchain, as it is not expected to fail
69 runs-on: ubuntu-latest
70 name: ubuntu / stable / minimal-versions
71 steps:
72 - uses: actions/checkout@v4
73 with:
74 submodules: true
75 - name: Install stable
76 uses: dtolnay/rust-toolchain@stable
77 - name: Install nightly for -Zminimal-versions
78 uses: dtolnay/rust-toolchain@nightly
79 - name: rustup default stable
80 run: rustup default stable
81 - name: cargo update -Zminimal-versions
82 run: cargo +nightly update -Zminimal-versions
83 - name: cargo test
84 run: cargo test --locked --all-features --all-targets
85 os-check:
86 # run cargo test on mac and windows
87 runs-on: ${{ matrix.os }}
88 name: ${{ matrix.os }} / stable
89 strategy:
90 fail-fast: false
91 matrix:
92 os: [macos-latest, windows-latest]
93 steps:
94 # if your project needs OpenSSL, uncomment this to fix Windows builds.
95 # it's commented out by default as the install command takes 5-10m.
96 # - run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
97 # if: runner.os == 'Windows'
98 # - run: vcpkg install openssl:x64-windows-static-md
99 # if: runner.os == 'Windows'
100 - uses: actions/checkout@v4
101 with:
102 submodules: true
103 - name: Install stable
104 uses: dtolnay/rust-toolchain@stable
105 - name: cargo generate-lockfile
106 if: hashFiles('Cargo.lock') == ''
107 run: cargo generate-lockfile
108 - name: cargo test
109 run: cargo test --locked --all-features --all-targets
110 coverage:
111 # use llvm-cov to build and collect coverage and outputs in a format that
112 # is compatible with codecov.io
113 #
114 # note that codecov as of v4 requires that CODECOV_TOKEN from
115 #
116 # https://app.codecov.io/gh/<user or org>/<project>/settings
117 #
118 # is set in two places on your repo:
119 #
120 # - https://github.com/jonhoo/guardian/settings/secrets/actions
121 # - https://github.com/jonhoo/guardian/settings/secrets/dependabot
122 #
123 # (the former is needed for codecov uploads to work with Dependabot PRs)
124 #
125 # PRs coming from forks of your repo will not have access to the token, but
126 # for those, codecov allows uploading coverage reports without a token.
127 # it's all a little weird and inconvenient. see
128 #
129 # https://github.com/codecov/feedback/issues/112
130 #
131 # for lots of more discussion
132 runs-on: ubuntu-latest
133 name: ubuntu / stable / coverage
134 steps:
135 - uses: actions/checkout@v4
136 with:
137 submodules: true
138 - name: Install stable
139 uses: dtolnay/rust-toolchain@stable
140 with:
141 components: llvm-tools-preview
142 - name: cargo install cargo-llvm-cov
143 uses: taiki-e/install-action@cargo-llvm-cov
144 - name: cargo generate-lockfile
145 if: hashFiles('Cargo.lock') == ''
146 run: cargo generate-lockfile
147 - name: cargo llvm-cov
148 run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
149 - name: Record Rust version
150 run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
151 - name: Upload to codecov.io
152 uses: codecov/codecov-action@v4
153 with:
154 fail_ci_if_error: true
155 token: ${{ secrets.CODECOV_TOKEN }}
156 env_vars: OS,RUST