chore: update jest to v29 #461
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: build | |
on: | |
push: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: ["client", "services/api", "pulumi"] | |
defaults: | |
run: | |
working-directory: ${{ matrix.directory }} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: npm ci | |
- run: npm run lint | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: ["services/api", "pulumi", "client"] | |
defaults: | |
run: | |
working-directory: ${{ matrix.directory }} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: npm ci | |
- run: npm run test | |
e2e-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: ["services/api"] | |
defaults: | |
run: | |
working-directory: ${{ matrix.directory }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: rrainn/[email protected] | |
with: | |
port: 8001 | |
- run: npm ci | |
- run: npm run test:e2e | |
playwright: | |
needs: [lint, test, e2e-test] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: e2e | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- uses: rrainn/[email protected] | |
with: | |
port: 8000 | |
- name: Start API | |
working-directory: services/api | |
run: | | |
npm ci | |
npm run db:init | |
npm run start:dev & | |
- name: Start Client | |
working-directory: client | |
run: | | |
npm ci | |
npm run dev & | |
env: | |
VITE_API_URL: http://localhost:3000 | |
- name: Configure environment | |
run: | | |
touch .env | |
echo "USER1_EMAIL=$USER1_EMAIL" >> .env | |
echo "USER1_PASSWORD=$USER1_PASSWORD" >> .env | |
echo "USER2_EMAIL=$USER2_EMAIL" >> .env | |
echo "USER2_PASSWORD=$USER2_PASSWORD" >> .env | |
env: | |
USER1_EMAIL: ${{ secrets.TEST_USER1_EMAIL }} | |
USER1_PASSWORD: ${{ secrets.TEST_USER1_PASSWORD }} | |
USER2_EMAIL: ${{ secrets.TEST_USER2_EMAIL }} | |
USER2_PASSWORD: ${{ secrets.TEST_USER2_PASSWORD }} | |
- name: Wait for services | |
run: | | |
npx --yes wait-on http://localhost:3000 | |
# Note: wait-on doesn't work with Vite when sending a head request | |
# https://github.com/jeffbski/wait-on/issues/78 | |
npx --yes wait-on tcp:5173 | |
- name: Run Playwright tests | |
run: npx playwright test | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: e2e/playwright-report/ | |
retention-days: 1 | |
mutation-test: | |
runs-on: ubuntu-latest | |
needs: [playwright] | |
if: github.ref == 'refs/heads/main' | |
env: | |
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} | |
defaults: | |
run: | |
working-directory: services/api | |
steps: | |
- uses: actions/checkout@v3 | |
- run: npm ci | |
- run: npm run test:mutate | |
build-api: | |
needs: [playwright] | |
if: github.ref == 'refs/heads/main' | |
uses: jbrunton/workflows/.github/workflows/build-image.yml@develop | |
with: | |
repo-name: jbrunton/chat-demo-api | |
working-directory: services/api | |
buildpack: paketo-buildpacks/nodejs | |
publish: true | |
docker-username: jbrunton | |
cache-image: jbrunton/chat-demo-api-cache-image:latest | |
secrets: | |
docker-access-token: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
deploy-staging: | |
environment: | |
name: Staging | |
url: https://chat-demo.staging.jbrunton-aws.com | |
concurrency: staging | |
needs: [build-api] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build Client | |
env: | |
VITE_API_URL: https://chat-demo-api.staging.jbrunton-aws.com | |
run: | | |
npm ci | |
npm run build | |
working-directory: client | |
- run: npm ci | |
working-directory: pulumi | |
- uses: pulumi/actions@v3 | |
with: | |
command: up | |
stack-name: staging | |
upsert: true | |
work-dir: pulumi | |
comment-on-pr: true | |
github-token: ${{ secrets.CI_MINION_PAT }} | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: us-east-1 | |
API_TAG: ${{ needs.build-api.outputs.tag }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy-production: | |
environment: | |
name: Production | |
url: https://chat-demo.jbrunton-aws.com | |
concurrency: production | |
needs: [build-api, deploy-staging] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: build | |
env: | |
VITE_API_URL: https://chat-demo-api.jbrunton-aws.com | |
run: | | |
npm ci | |
npm run build | |
working-directory: client | |
- run: npm ci | |
working-directory: pulumi | |
- uses: pulumi/actions@v3 | |
with: | |
command: up | |
stack-name: production | |
upsert: true | |
work-dir: pulumi | |
comment-on-pr: true | |
github-token: ${{ secrets.CI_MINION_PAT }} | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: us-east-1 | |
API_TAG: ${{ needs.build-api.outputs.tag }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |