-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (82 loc) · 3.04 KB
/
pull-request.yaml
File metadata and controls
92 lines (82 loc) · 3.04 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Fast tests only. We should try and keep this under one minute.
# See https://github.com/prql/prql/issues/37 for some TODOs
name: pull-request
on:
pull_request:
# Add `labeled`, so we can trigger a new run by adding a `pr-test-all`
# label, which we then use to trigger a `test-all` run.
types: [opened, reopened, synchronize, labeled]
# While most of these tests are covered by `test-all`, we need to build the cache.
push:
branches:
- main
concurrency:
# This adds `job` to the key so when running full tests, we don't cancel the
# overlapping jobs, since GH relies on them passing before allowing a PR to
# pass.
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
cancel-in-progress: true
jobs:
# Only run ubuntu on pull-requests, since it's fastest.
test-rust:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# TODO: I'm sure there's a better way of doing this, where `target_option` derives from `target`?
- target: ""
- target: "wasm32-unknown-unknown"
target_option: "--target=wasm32-unknown-unknown"
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- name: 📋 Test workspace
uses: ./.github/actions/test-rust
with:
target: ${{ matrix.target }}
target_option: ${{ matrix.target_option }}
test-book:
runs-on: ubuntu-latest
steps:
- name: 📂 Checkout code
uses: actions/checkout@v3
- name: 🔗 Setup rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
# https://github.com/actions-rs/toolchain/issues/126
toolchain: stable
- name: 💰 Cache
uses: Swatinem/rust-cache@v1
- uses: peaceiris/actions-mdbook@v1
- uses: baptiste0928/cargo-install@v1
with:
crate: mdbook-admonish
version: "1.7.0"
- name: 🔨 Build
run: mdbook build
working-directory: book/
# Run Mac & Windows & other tests a `pr-test-all` label (as well as on `main`).
test-all:
uses: ./.github/workflows/test-all.yaml
if: contains(github.event.pull_request.labels.*.name, 'pr-test-all')
publish:
uses: ./.github/workflows/publish-web.yaml
if: contains(github.event.pull_request.labels.*.name, 'pr-publish-web')
cron:
uses: ./.github/workflows/cron.yaml
if: contains(github.event.pull_request.labels.*.name, 'pr-cron')
check-links:
# Another option is https://github.com/lycheeverse/lychee, but it was
# weirdly difficult to exclude a directory, and I managed to get
# rate-limited by GH because of it scanning node_modules.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: .markdown-link-check.json
base-branch: main
# We also run without this in the cron workflow (maybe there's a
# better way of organizing these so we DRY)
check-modified-files-only: "yes"