-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (133 loc) · 3.95 KB
/
main.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
131
132
133
134
135
136
137
name: Continuous integration
on:
push:
branches:
- master
pull_request:
jobs:
check:
name: Compile and Test
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- nightly
- stable
# MSRV - Required for using "strip" in Cargo.toml under "[profile.release]"
- 1.60.0
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/cache@v1
with:
path: |
~/.cargo
target/
key: ${{ runner.os }}-${{ github.job }}-${{ matrix.rust }}
- name: Setup Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: ls -la */*
- name: Type Checking
uses: actions-rs/cargo@v1
with:
command: check
args: --all --verbose --locked
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all --verbose --locked
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all --verbose --locked
compile-to-wasm:
name: Compile to WebAssembly
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- nightly
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/cache@v1
with:
path: |
~/.cargo
target/
Cargo.lock
key: ${{ runner.os }}-${{ github.job }}-${{ matrix.rust }}
- name: Setup Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
target: wasm32-unknown-unknown
- name: Compile to WebAssembly
uses: actions-rs/cargo@v1
continue-on-error: true
with:
command: xtask
args: dist --out-dir target/proc-blocks
env:
RUST_LOG: xtask=debug
- name: Save Compiled proc-blocks
uses: actions/upload-artifact@v2
continue-on-error: true
with:
name: compiled-proc-blocks
path: target/proc-blocks
# Deploy the compiled proc-blocks to S3
- name: Set AWS credentials
uses: aws-actions/configure-aws-credentials@v1
if: github.ref == 'refs/heads/master'
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload compiled proc-blocks to S3
run: aws s3 sync target/proc-blocks s3://assets.hotg.ai/proc-blocks
# FIXME(@Michael-F-Bryan): see https://github.com/hotg-ai/proc-blocks/issues/44
if: github.ref == 'refs/heads/master' && false
- name: Invalidate Cloudfront
run: aws cloudfront create-invalidation --distribution-id=${{ secrets.AWS_DISTRIBUTION_ID }} --paths="/proc-blocks/*"
if: github.ref == 'refs/heads/master' && false
api-docs:
name: Publish API Docs to GitHub Pages
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- nightly
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: doc
args: --all --verbose --locked
- name: Redirect top-level GitHub Pages
run: 'echo ''<meta http-equiv="refresh" content="0; url=proc_blocks/index.html" />'' > target/doc/index.html'
shell: bash
- name: Upload API Docs
uses: JamesIves/[email protected]
if: github.ref == 'refs/heads/master'
with:
branch: gh-pages
folder: target/doc
single-commit: true