Skip to content

Commit abcf3b0

Browse files
committed
update actions
Make datatest-stable like quick-junit.
1 parent 0b3cff8 commit abcf3b0

File tree

7 files changed

+139
-43
lines changed

7 files changed

+139
-43
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,72 @@ on:
77
- main
88

99
name: CI
10+
env:
11+
RUSTFLAGS: -D warnings
12+
CARGO_TERM_COLOR: always
1013

1114
jobs:
1215
lint:
1316
name: Lint
1417
runs-on: ubuntu-latest
15-
env:
16-
RUSTFLAGS: -D warnings
1718
steps:
1819
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
1920
- uses: dtolnay/rust-toolchain@stable
2021
with:
2122
components: rustfmt, clippy
2223
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
23-
- name: Lint (rustfmt)
24-
run: cargo xfmt --check
2524
- name: Lint (clippy)
2625
run: cargo clippy --all-features --all-targets
26+
- name: Lint (rustfmt)
27+
run: cargo xfmt --check
28+
- name: Install cargo readme
29+
uses: taiki-e/install-action@834a7b93e0c678fb40309ee0e36546336d5c6ea7 # v2
30+
with:
31+
tool: cargo-readme
32+
- name: Run cargo readme
33+
run: ./scripts/regenerate-readmes.sh
34+
- name: Check for differences
35+
run: git diff --exit-code
36+
37+
build-rustdoc:
38+
name: Build documentation
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest]
43+
fail-fast: false
44+
steps:
45+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
46+
- uses: dtolnay/rust-toolchain@stable
47+
with:
48+
components: rustfmt, clippy
49+
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
50+
- name: Build rustdoc
51+
run: cargo doc --all-features
2752

2853
build:
2954
name: Build and test
3055
runs-on: ${{ matrix.os }}
3156
strategy:
3257
matrix:
33-
os: [ ubuntu-latest, macos-latest, windows-latest ]
58+
os:
59+
- ubuntu-latest
3460
# 1.60 is the MSRV
35-
rust-version: [ "1.60", stable ]
61+
rust-version: ["1.60", stable]
3662
fail-fast: false
37-
env:
38-
RUSTFLAGS: -D warnings
3963
steps:
4064
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
41-
- uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1
65+
- uses: dtolnay/rust-toolchain@master
4266
with:
4367
toolchain: ${{ matrix.rust-version }}
4468
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
69+
with:
70+
key: ${{ matrix.rust-version }}
4571
- name: Build
4672
run: cargo build
47-
- name: Install nextest
73+
- name: Install latest nextest release
4874
uses: taiki-e/install-action@nextest
49-
- name: Test
50-
run: cargo nextest run --all-features
51-
- name: Delete Cargo.lock and test against latest versions
52-
if: matrix.rust-version == 'stable'
53-
run: |
54-
rm Cargo.lock
55-
cargo nextest run --all-features
75+
- name: Build datatest-stable
76+
run: cargo build
77+
- name: Run tests
78+
run: cargo nextest run

.github/workflows/coverage.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
branches:
7+
- main
8+
9+
name: Test coverage
10+
11+
jobs:
12+
coverage:
13+
name: Collect test coverage
14+
runs-on: ubuntu-latest
15+
# nightly rust might break from time to time
16+
continue-on-error: true
17+
env:
18+
RUSTFLAGS: -D warnings
19+
CARGO_TERM_COLOR: always
20+
steps:
21+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
22+
# Nightly Rust is used for cargo llvm-cov --doc below.
23+
- uses: dtolnay/rust-toolchain@nightly
24+
with:
25+
components: llvm-tools-preview
26+
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2
27+
28+
- name: Install latest nextest release
29+
uses: taiki-e/install-action@nextest
30+
- name: Install cargo-llvm-cov
31+
uses: taiki-e/install-action@cargo-llvm-cov
32+
33+
- name: Collect coverage data
34+
# Generate separate reports for nextest and doctests, and combine them.
35+
run: |
36+
cargo llvm-cov --no-report nextest
37+
cargo llvm-cov --no-report --doc
38+
cargo llvm-cov report --doctests --lcov --output-path lcov.info
39+
- name: Upload coverage data to codecov
40+
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4
41+
env:
42+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
43+
with:
44+
files: lcov.info

.github/workflows/docs.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ name: Docs
88
jobs:
99
docs:
1010
name: Build and deploy documentation
11+
concurrency: ci-${{ github.ref }}
1112
runs-on: ubuntu-latest
1213
steps:
1314
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
14-
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1
15-
with:
16-
toolchain: stable
17-
- name: Build rustdoc
18-
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
19-
with:
20-
command: doc
21-
args: --all-features
15+
- uses: dtolnay/rust-toolchain@stable
16+
- name: Build rustdocs
17+
run: ./scripts/build-docs.sh
2218
- name: Organize
2319
run: |
20+
rm -rf target/gh-pages
2421
mkdir target/gh-pages
22+
mv target/doc/_redirects target/gh-pages
2523
mv target/doc target/gh-pages/rustdoc
26-
- name: Deploy
27-
uses: JamesIves/github-pages-deploy-action@releases/v3
24+
- name: Publish
25+
uses: cloudflare/pages-action@1
2826
with:
29-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
BRANCH: gh-pages
31-
FOLDER: target/gh-pages
27+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
28+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
29+
projectName: datatest-stable
30+
directory: target/gh-pages
31+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
# adapted from https://github.com/taiki-e/cargo-hack/blob/main/.github/workflows/release.yml
22

3-
name: Publish release
3+
name: Publish releases to GitHub
44
on:
55
push:
66
tags:
7-
- '*'
7+
- "*"
88

99
jobs:
10-
create-release:
11-
if: github.repository_owner == 'nextest-rs'
10+
datatest-stable-release:
11+
if: github.repository_owner == 'nextest-rs' && startsWith(github.ref_name, 'datatest-stable-')
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
1515
with:
1616
persist-credentials: false
1717
- name: Install Rust
18-
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1
18+
uses: dtolnay/rust-toolchain@stable
19+
- name: Install cargo release
20+
uses: taiki-e/install-action@834a7b93e0c678fb40309ee0e36546336d5c6ea7 # v2
1921
with:
20-
toolchain: stable
21-
override: true
22-
- run: cargo publish
23-
env:
24-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
22+
tool: cargo-release@0.25.0
2523
- uses: taiki-e/create-gh-release-action@8df4de6534ceacdaed10a08f73418ca751f31793 # v1
2624
with:
25+
prefix: datatest-stable
2726
changelog: CHANGELOG.md
28-
title: datatest-stable $version
27+
title: $prefix $version
2928
branch: main
30-
prefix: datatest-stable
3129
env:
3230
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- run: ./scripts/cargo-release-publish.sh
32+
env:
33+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

README.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ license](LICENSE-MIT).
1717
README.md is generated from README.tpl by cargo readme. To regenerate:
1818
1919
cargo install cargo-readme
20-
cargo readme > README.md
20+
./scripts/regenerate-readmes.sh
2121
-->

scripts/build-docs.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
# Build docs for all crates and direct dependencies. The gawk script turns e.g. "quick-junit v0.1.0"
4+
# into "quick-junit@0.1.0".
5+
cargo tree --depth 1 -e normal --prefix none \
6+
| gawk '{ gsub(" v", "@", $0); printf("%s\n", $1); }' \
7+
| xargs printf -- '-p %s\n' \
8+
| xargs cargo doc --no-deps --lib
9+
10+
# Also drop a _redirects file in the root of the docs directory -- this will be picked up by the
11+
# CI script.
12+
echo "/ /rustdoc/datatest_stable/ 301" > target/doc/_redirects

scripts/cargo-release-publish.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Use cargo-release to publish crates to crates.io.
4+
5+
set -xe -o pipefail
6+
7+
# cargo-release requires a release off a branch (maybe it shouldn't?)
8+
# Check out this branch, creating it if it doesn't exist.
9+
git checkout -B to-release
10+
11+
# --execute: actually does the release
12+
# --no-confirm: don't ask for confirmation, since this is a non-interactive script
13+
cargo release publish --publish --execute --no-confirm --workspace "$@"
14+
15+
git checkout -
16+
git branch -D to-release

0 commit comments

Comments
 (0)