-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (83 loc) · 2.47 KB
/
release.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
---
name: Release Binaries on Tag
on:
push:
tags:
- v*
workflow_dispatch:
env:
RUSTFLAGS: '--deny warnings'
jobs:
# Check the rust formatting
format:
name: Rust Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust Toolchain setup
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Format Check
uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
clippy:
name: Rust Clippy Check
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Rust Toolchain setup
uses: dtolnay/rust-toolchain@stable
with:
components: cargo, clippy
- name: clippy-sarif setup
run: cargo install clippy-sarif sarif-fmt
- name: Run rust-clippy
run: cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
continue-on-error: true
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
# Deploy to the production environment
deploy:
name: Deploy to the Production Environment
runs-on: ubuntu-latest
needs: [format, clippy]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust Toolchain setup
uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- name: Build rust code
run: cargo build
- name: Setup Node
uses: actions/setup-node@v4
- name: Wrangler setup
run: npm install -g wrangler
- name: Build wasm and deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: wrangler deploy --env=prod
- name: Test the build
run: |
sleep 5
curl -s https://id.a1ecbr0wn.com > prod.ip
curl -s https://ident.me > idm.ip
if ! cmp -s prod.ip idm.ip; then
echo "::error title=Deploy Test Failure::IP addresses from id.a1ecbr0wn.com and ident.me do not match"
echo "Control Response:"
cat idm.ip
echo "Prod Response:"
cat prod.ip
exit 1
fi