-
Notifications
You must be signed in to change notification settings - Fork 309
67 lines (58 loc) · 1.56 KB
/
main.yml
File metadata and controls
67 lines (58 loc) · 1.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
name: CI
on:
push:
branches:
- main
pull_request:
# Allow rebuilding/redeploying the web manually
workflow_dispatch:
schedule:
# Rebuild the web periodically at 22:00 UTC to update team API contents and Rust version.
# Time must be kept in sync with the `autoupdate` parameter in
# `templates/components/footer.html.hbs`.
- cron: '0 22 * * *'
env:
RUST_BACKTRACE: 1
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt
- uses: Swatinem/rust-cache@v2
- name: Test
run: |
set -euo pipefail
# Check if the code is good
cargo build --all --locked
cargo clippy -- --deny warnings
cargo test --all --locked
- name: Formatting
run: cargo fmt --all -- --check
- name: Build website
run: cargo run
env:
BASE_URL: "/"
- name: Disable Jekyll
run: touch build/.nojekyll
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Upload website
uses: actions/upload-pages-artifact@v3
with:
path: build
deploy:
needs: [ build ]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
environment:
name: github-pages
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4