-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci.yml
121 lines (121 loc) · 3.1 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
name: CI
on: [push]
concurrency:
group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
DISPLAY: :99
RUST_BACKTRACE: 1
LANGUAGE: en_AU
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- &rust_cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.toml') }}
- run: cargo xtask ci
generate:
needs:
- ci
name: Generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- *rust_cache
- id: configure-pages
uses: actions/configure-pages@v3
- run: cargo generate ${{steps.configure-pages.outputs.base_url}}
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- run: |
chromedriver --log-level=ALL --log-path=chromedriver.log &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- run: cargo crawl
- uses: actions/upload-artifact@v3
with:
name: site
path: _site
validate:
needs:
- generate
name: Validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: site
path: _site
- run: pip install git+https://github.com/tommy-gilligan/html5validator.git
- run: html5validator --root _site/ --also-check-css
- *rust_cache
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- run: &start_chrome_driver |
chromedriver --log-level=ALL --log-path=chromedriver.log &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- run: cargo test -- browser_
- uses: actions/upload-artifact@v3
if: always()
with:
name: validate-screenshots
path: screenshots
deploy:
needs:
- ci
- validate
- screenshot
name: Deploy
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: site
path: _site
- uses: actions/upload-pages-artifact@v2
- uses: actions/deploy-pages@v2
screenshot:
needs:
- generate
name: Screenshot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: site
path: _site
- *rust_cache
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- run: *start_chrome_driver
- run: cargo screenshot
- uses: actions/upload-artifact@v3
if: always()
with:
name: screenshots
path: screenshots
- uses: actions/upload-artifact@v3
if: always()
with:
name: chromedriver-log
path: chromedriver.log