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

Prepare production deploy by workflow #80

Closed
wants to merge 7 commits into from
Closed
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
93 changes: 93 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: "Deploy to production"

on:
workflow_dispatch:

jobs:
frontend-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- name: Get the code
uses: actions/checkout@v4
- name: Install nodeJS
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install deps
run: npm ci
- name: Run tests
run: npm test
back-integration-tests:
needs: frontend-tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- name: Get the code
uses: actions/checkout@v4
- name: Install nodeJS
uses: actions/setup-node@v4
with:
node-version: 20
- name: Make envfile
run: cp .env.example .env
- name: Install deps
run: npm ci
- name: Start test DB
run: npm run testDb:wait
- name: Run tests
run: npm test
back-e2e-test:
needs: back-integration-tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./test-e2e
steps:
- name: Get the code
uses: actions/checkout@v4
- name: Layers cache
uses: satackey/action-docker-layer-caching@v0.0.11
continue-on-error: true
- name: Install nodeJS
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install deps
run: npm ci
- name: Install backend deps
run: cd ../backend && npm ci
- name: Store Playwright's Version
run: |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright Browsers for Playwright's Version
id: cache-playwright-browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
- name: Setup Playwright
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Make envfiles
run: |
cp .env.example .env
cd ../backend/ && cp .env.example .env
cd ../frontend/ && cp .env.example .env
- name: Start app
run: npm run app:start
- name: Run Playwright tests
run: npm run test
- name: Store Artifacts from Failed Tests
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results/
retention-days: 7
Loading