Use an in-memory repository to save shortened url #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | | |
| cp .env-dev .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!" |