Skip to content

CI Build

CI Build #234

Workflow file for this run

---
name: CI Build
on:
push:
branches:
- "**"
paths-ignore:
- '**/*.md'
- 'LICENSE'
workflow_dispatch:
schedule:
- cron: '0 0 * * 1'
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:
name: Deploy to the Test 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: 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=test
- name: Test the build
run: |
sleep 5
curl -s https://test-id.a1ecbr0wn.workers.dev > test.ip
curl -s https://ident.me > idm.ip
if ! cmp -s test.ip idm.ip; then
echo "::error title=Deploy Test Failure::IP addresses from test-id.a1ecbr0wn.workers.dev and ident.me do not match"
cat prod.ip
cat idm.ip
exit 1
fi