[app] MVP #314
Workflow file for this run
This file contains 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: Backend | |
on: [push, pull_request_target] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
# Required to checkout the code | |
contents: read | |
# Required to put a comment into the pull-request | |
pull-requests: write | |
steps: | |
- name: Checkout the base branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Checkout the PR code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: "pr-code" # Check out to a separate path to avoid mixing code bases | |
# Setting up the environment | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
# Install dependencies in the PR code's backend directory | |
- name: "Install Deps" | |
run: pnpm install | |
working-directory: ./pr-code/backend | |
# Build environment variables | |
- name: "Build .env" | |
run: | | |
echo TWILIO_AUTH_TOKEN=${{ secrets.TWILIO_AUTH_TOKEN }} >> .env | |
echo TWILIO_ACCOUNT_SID=${{ secrets.TWILIO_ACCOUNT_SID }} >> .env | |
echo TWILIO_PHONE_NUMBER=${{ secrets.TWILIO_PHONE_NUMBER }} >> .env | |
echo TEST_PHONE_NUMBER=${{ secrets.TEST_PHONE_NUMBER }} >> .env | |
echo NODE_URL=${{ secrets.NODE_URL}} >> .env | |
echo DEPLOYER_PK=${{ secrets.DEPLOYER_PK}} >> .env | |
echo DEPLOYER_ADDRESS=${{ secrets.DEPLOYER_ADDRESS}} >> .env | |
working-directory: ./pr-code/backend | |
# Check format and lint in the PR code's backend directory | |
- name: "Check format and lint" | |
run: pnpm lint | |
working-directory: ./pr-code/backend | |
# Generate coverage report in the PR code's backend directory | |
- name: "Coverage" | |
run: pnpm vitest --pool=forks --coverage.enabled true | |
working-directory: ./pr-code/backend | |
# Upload coverage report artifact | |
- name: "Upload Coverage" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: ./pr-code/backend/coverage | |
# Upload vitest config file | |
- name: "Upload vitest config" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vitest.config.ts | |
path: ./pr-code/backend/vitest.config.ts |