Fix release test (#42) #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |