1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
permissions:
contents: read
on:
push:
branches:
- feature/*
pull_request:
workflow_dispatch:
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR.
# Ensures that we don't waste CI time, and returns results quicker
# https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: test
jobs:
required:
runs-on: ubuntu-22.04
name: ubuntu / ${{ matrix.toolchain }}
strategy:
matrix:
# run on stable and beta to ensure that tests won't break on the next version of the rust
# toolchain
#, beta
toolchain:
steps:
- uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.CROSS_REPO_TOKEN }}
#Configure git to auth with the cross repo PAT
- run: git config --global url."https://${{ secrets.CROSS_REPO_TOKEN }}@github.com".insteadOf ssh://git@github.com
# - run: git config --global url."https://${{ secrets.CROSS_REPO_TOKEN }}@github.com".insteadOf https://github.com
- uses: Swatinem/rust-cache@v2
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: isbang/compose-action@v1.5.1
with:
#could have a copy in .github with different settings to local
#compose-file: ".github/docker-compose.yml"
compose-file: ".github/docker-compose.yml"
- name: cargo generate-lockfile
# enable this ci template to run regardless of whether the lockfile is checked in or not
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
#Build before starting K8s cluster - no pointing starting if build will fail
- name: cargo build
run: cargo build
# https://twitter.com/jonhoo/status/1571290371124260865
- name: cargo test --locked
run: cargo test --locked --all-features --all-targets
# https://github.com/rust-lang/cargo/issues/6669
- name: cargo test --doc
run: cargo test --locked --all-features --doc