Skip to content

Commit

Permalink
chore: add GitHub Actions CI config files
Browse files Browse the repository at this point in the history
  • Loading branch information
georgetayqy committed Sep 23, 2024
1 parent 76545f5 commit 8ca08ac
Showing 1 changed file with 155 additions and 0 deletions.
155 changes: 155 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: 'Continuous Integration GitHub Actions Workflow'

on:
push:
pull_request:
workflow_dispatch:

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [20, 22]
name: Run tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Codebase
uses: actions/checkout@v4
- name: Setup Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

scans:
# do code scanning stuff here
needs: test
name: Run code scanning tools here
runs-on: ubuntu-latest
steps:
- name: Checkout Codebase
uses: actions/checkout@v4

build-staging:
# build stuff here
needs: test
environment: staging
name: Build necessary components here
runs-on: ubuntu-latest
steps:
- name: Checkout Codebase
uses: actions/checkout@v4
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Build and Deploy Frontend
working-directory: peer-prep
run: |
npm i
npm run build
- name: Upload to S3
working-directory: peer-prep
run: |
aws s3 sync . s3://peerprep-frontend-bucket
build-production:
# build stuff here
needs: build-staging
environment: production
name: Build necessary components here
runs-on: ubuntu-latest
steps:
- name: Checkout Codebase
uses: actions/checkout@v4
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
env:
AWS_REGION: 'ap-southeast-1'
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Build and Deploy Frontend
working-directory: peer-prep
run: |
npm i
npm run build
- name: Upload to S3
working-directory: peer-prep
run: |
aws s3 sync . s3://peerprep-frontend-bucket
images:
# build images here
needs:
- build-staging
- build-production
name: Build images here
runs-on: ubuntu-latest
steps:
- name: Checkout Codebase
uses: actions/checkout@v4

# deploy:
# # deploy stuff here
# needs: images
# name: Deploy images and infrastructure here
# strategy:
# matrix:
# providers:
# [
# {
# init: './terraform/init/aws',
# deploy: './terraform/env/aws',
# csp: 'AWS',
# },
# {
# init: './terraform/init/aws',
# deploy: './terraform/env/aws',
# csp: 'GCP',
# },
# ]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Codebase
# uses: actions/checkout@v4

# - name: Setup Terraform for ${{ matrix.providers.csp }}
# uses: hashicorp/setup-terraform@v3

# - name: Ensure Provision of Remote State Backends on ${{ matrix.providers.csp }}
# working-directory: ${{ matrix.providers.init }}
# run: terraform init

# - name: Check and Deploy State Backends on ${{ matrix.providers.csp }}
# working-directory: ${{ matrix.providers.init }}
# run: terraform apply -auto-approve
# continue-on-error: true # assumes that the buckets are already provisioned

# # commands taken from https://github.com/gruntwork-io/terragrunt-action
# - name: Initialise Terraform Infrastructure with Terragrunt on ${{ matrix.providers.csp }}
# uses: gruntwork-io/terragrunt-action@v2
# with:
# tf_version: ''
# tg_version: ''
# tg_dir: ${{ matrix.providers.deploy }}
# tg_command: 'plan'

# - name: Setup Infrastructure with Terragrunt on ${{ matrix.providers.csp }}
# uses: gruntwork-io/terragrunt-action@v2
# with:
# tf_version: ''
# tg_version: ''
# tg_dir: ${{ matrix.providers.deploy }}
# tg_command: 'apply'

0 comments on commit 8ca08ac

Please sign in to comment.