-
Notifications
You must be signed in to change notification settings - Fork 11
130 lines (125 loc) · 4.78 KB
/
ci.yml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI
on: [ push, workflow_dispatch ]
jobs:
check_nix_packages:
name: Check Nix Flake
runs-on: ubuntu-24.04
steps:
- name: Get Repository from Git
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Set up Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check Nixpkgs Inputs
uses: DeterminateSystems/flake-checker-action@main
lint:
name: Run Rustfmt and Clippy on Rust
runs-on: ubuntu-24.04
steps:
- name: Get Repository from Git
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Set up Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
# For some reason, GitHub provides Rust for us. The problem is that, when
# executing the recursive cargo invocation, the cargo in ~/.cargo/bin ends
# up prepended to PATH, which then causes problems.
- name: Remove Rust provided by GitHub.
run: rm -rf ~/.cargo ~/.rustup
- name: Lint
run: ./scripts/lint.sh
run_all_tests_on_maelstrom:
name: Run All Maelstrom Tests on Maelstrom
runs-on: ubuntu-24.04
steps:
- name: Get Repository from Git
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Set up Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
# For some reason, GitHub provides Rust for us. The problem is that, when
# executing the recursive cargo invocation, the cargo in ~/.cargo/bin ends
# up prepended to PATH, which then causes problems.
- name: Remove Rust provided by GitHub.
run: rm -rf ~/.cargo/bin ~/.rustup
- name: Disable apparmor container restrictions
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- name: Install Nix Flake
run: nix develop --command echo done
- name: Get Rust version
run: echo "RUST_VERSION=$(nix develop --command rustc --version | cut -d' ' -f2)" >> $GITHUB_ENV
- name: Set up Rust Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: maelstrom-${{ hashFiles('Cargo.lock', 'flake.lock') }}-${{ env.RUST_VERSION }}
- name: Expose GitHub Action Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Test
run: ./scripts/run-tests-on-maelstrom.sh "${{ env.ACTIONS_RUNTIME_TOKEN }}" "${{ env.ACTIONS_RESULTS_URL }}"
github_api_tests:
name: Run GitHub API tests
runs-on: ubuntu-24.04
steps:
- name: Get Repository from Git
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Set up Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
# For some reason, GitHub provides Rust for us. The problem is that, when
# executing the recursive cargo invocation, the cargo in ~/.cargo/bin ends
# up prepended to PATH, which then causes problems.
- name: Remove Rust provided by GitHub.
run: rm -rf ~/.cargo/bin ~/.rustup
- name: Expose GitHub Action Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Test
run: nix develop --command cargo test --package maelstrom-github tests::real_github_integration_test -- --nocapture
deploy-documentation:
name: Build and Deploy Documentation
runs-on: ubuntu-24.04
permissions:
contents: write # To push a branch
pages: write # To push to a GitHub Pages site
id-token: write # To update the deployment status
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Latest mdBook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Build Documentation
run: |
mkdir -p website/static/doc/book
cd doc/book
./build-all-versions.sh ../../website/static/doc/book
- name: Install Zola
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Build Website with Zola
run: |
cd website
zola build
- name: Set up Pages
uses: actions/configure-pages@v4
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'website/public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4