Repository navigation
74 lines (67 loc) · 2.56 KB
/
Copy pathtest-deploy.yaml
File metadata and controls
74 lines (67 loc) · 2.56 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
name: Test deployment
# `main` is built by `deploy.yaml`, which also publishes it, so this workflow
# builds every other branch and every pull request instead of duplicating that
# build.
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
on:
push:
branches-ignore:
- main
pull_request: {}
# Cancel in-progress runs when a new commit is pushed to the same PR, branch, or tag.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
# To minimize supply-chain exposure this workflow uses only GitHub's own
# first-party actions. Each job runs a check the repository's documentation
# lists: the site build from README.md, and the snippet tests from
# example-code/README.md.
jobs:
build:
name: Build the site
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# The skill pages under docs/ai/skills/ are symlinks into the
# cgp-skills submodule; without it the build fails on missing files.
submodules: recursive
- uses: actions/setup-node@v4
with:
# `.nvmrc` pins the runtime so a Node release cannot change the build
# without a commit.
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Test build website
run: npm run build
example-code:
name: Snippet tests
runs-on: ubuntu-latest
timeout-minutes: 30
env:
CARGO_TERM_COLOR: always
steps:
# `example-code` takes `cgp` from crates.io, so the website is the only
# checkout.
- name: Check out the website
uses: actions/checkout@v4
with:
path: contextgeneric.dev
# `example-code/rust-toolchain.toml` pins the compiler the snapshots are
# blessed with; rustup installs that channel from this directory.
- name: Install the pinned Rust toolchain
working-directory: contextgeneric.dev/example-code
run: rustup toolchain install
# The pages' snippets are compiled here, so a page cannot drift from the
# library without a red build. The compile-fail snapshots are skipped
# here; run them locally with `cargo test`.
- name: Run the snippet tests
working-directory: contextgeneric.dev/example-code
run: cargo test -- --skip rejected_snippets_do_not_compile