102 lines
2.3 KiB
YAML
102 lines
2.3 KiB
YAML
name: Full Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
react-build:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: .
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run Linter
|
|
run: npm run lint --if-present
|
|
|
|
- name: Run Tests
|
|
run: npm test -- --watchAll=false
|
|
|
|
go-build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Build Go service
|
|
working-directory: functions/go
|
|
run: go build
|
|
|
|
- name: Deploy placeholder
|
|
run: echo "Deploy the Go function to AWS Lambda from this step."
|
|
|
|
rust-build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Build Rust service
|
|
working-directory: functions/rust
|
|
run: cargo build --release
|
|
|
|
- name: Deploy placeholder
|
|
run: echo "Deploy the Rust function to AWS Lambda from this step."
|
|
|
|
python-build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install dependencies
|
|
working-directory: functions/python
|
|
run: pip3 install -r requirements.txt
|
|
|
|
- name: Deploy placeholder
|
|
run: echo "Deploy the Python function to AWS Lambda with Mangum from this step."
|
|
|
|
# Deployment (Waits for manual approval after all build jobs pass)
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: [react-build, go-build, rust-build, python-build]
|
|
environment: production
|
|
|
|
steps:
|
|
- name: Trigger webhook using curl
|
|
env:
|
|
WEBHOOK_URL: ${{ secrets.AMPLIFY_WEBHOOK_URL }}
|
|
run: |
|
|
curl -i --fail -X POST -H "Content-Type: application/json" -d '{}' "$WEBHOOK_URL"
|