Skip to content

Enable CI tests on frontend #27

Enable CI tests on frontend

Enable CI tests on frontend #27

Workflow file for this run

name: Tiny URL CI Pipeline
on:
push:
branches:
- '**'
pull_request:
branches:
- main
jobs:
api:
name: API Build & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: api
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
cache-dependency-path: api/yarn.lock # Specify the path to your yarn.lock
- name: Install Dependencies (API)
working-directory: api
run: yarn install --frozen-lockfile
#- name: Lint API
# run: npm run lint
- name: Create .env file
run: |
echo "MACHINE_ID=1" > .env
working-directory: api # Ensure it is created inside `api/`
- name: Run Tests (API)
run: yarn test
- name: Build API
run: yarn build
# Webapp (Next.js) Build & Test
webapp:
name: Webapp Build & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: webapp
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
cache-dependency-path: webapp/yarn.lock # Specify the path to your yarn.lock
- name: Install Dependencies (Webapp)
run: yarn install --frozen-lockfile
- name: Lint Webapp
run: yarn lint
- name: Run Tests (Webapp)
run: npm test
- name: Build Webapp
run: yarn build
# Merge Blocker: Ensure Both Builds Pass
merge_guard:
name: Ensure All Jobs Passed
needs: [ api, webapp ]
runs-on: ubuntu-latest
steps:
- name: Check for Failures
run: echo "All jobs passed!"