Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline github actions #107

Merged
merged 10 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 34 additions & 11 deletions .github/workflows/Backend_CI.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Backend Services CI
# targeting pull requests to master branch
on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_call:
jobs:
tests:
Backend_build:
name: Backend build
permissions:
checks: write
pull-requests: write
Expand Down Expand Up @@ -38,18 +36,43 @@ jobs:
cmd: install
dir: backend/${{matrix.service}}

- name: Run Test Suites
- name: Run Yarn Build
env:
NODE_ENV: test
uses: borales/actions-yarn@v4
with:
cmd: test
cmd: build
dir: backend/${{matrix.service}}
Backend_tests:
name: Backend tests
needs: Backend_build
permissions:
checks: write
pull-requests: write
contents: write
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [20.x]
service: [assignment-service, grading-service, user-service]

- name: Run Yarn Build
env:
NODE_ENV: test
steps:
- name: Checkout Current Branch
uses: actions/checkout@v4

- name: Use Node.js ${{matrix.node-version}}
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}

- name: Clean up
run: |
rm -rf backend/${{matrix.service}}/node_modules
rm -rf backend/${{matrix.service}}/coverage

- name: Install Dependencies Using yarn
uses: borales/actions-yarn@v4
with:
cmd: build
cmd: install
dir: backend/${{matrix.service}}
5 changes: 1 addition & 4 deletions .github/workflows/CD_to_AKS.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Build and deploy an app to AKS

on:
pull_request:
types: [closed]
branches:
- master
workflow_call:
workflow_dispatch:

env:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/Overall_CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Overall CI
# targeting pull requests to master branch
on:
workflow_call:
pull_request:
branches: [master]
push:
branches: [master]
jobs:
frontend_ci:
uses: ./.github/workflows/frontend_CI.yml
backend_ci:
uses: ./.github/workflows/Backend_CI.yml
deploy_production:
name: Deploy Production
needs: [frontend_ci, backend_ci]
if: github.repository == 'CS3213-Frontend-Management-System/master' && github.ref_type == 'tag'
uses: ./.github/workflows/CD_to_AKS.yml
53 changes: 41 additions & 12 deletions .github/workflows/frontend_CI.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
name: Frontend CI
# targeting pull requests to master branch
on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_call:
jobs:
tests:
Frontend_build:
permissions:
checks: write
pull-requests: write
Expand Down Expand Up @@ -35,18 +31,51 @@ jobs:
with:
cmd: install
dir: frontend

- name: Run Test Suites
- name: Run Next Build
env:
NODE_ENV: test
uses: borales/actions-yarn@v4
with:
cmd: test
cmd: build
dir: frontend
- name: Run Next Build

Frontend_tests:
name: Frontend Tests
needs: Frontend_build
permissions:
checks: write
pull-requests: write
contents: write
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [20.x]

steps:
- name: Checkout Current Branch
uses: actions/checkout@v4

- name: Use Node.js ${{matrix.node-version}}
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node-version}}

- name: Clean up
run: |
rm -rf frontend/node_modules
rm -rf frontend/coverage
- name: Install Dependencies Using yarn
uses: borales/actions-yarn@v4
with:
cmd: install
dir: frontend

- name: Run Test Suites
env:
NODE_ENV: test
uses: borales/actions-yarn@v4
with:
cmd: build
dir: frontend
cmd: test
dir: frontend