Update all dependencies #140
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
env: | |
DOCKER_REGISTRY: ghcr.io | |
DOCKER_SCAN_SUGGEST: false | |
name: Test | |
on: | |
pull_request: | |
jobs: | |
review-frontend-code: | |
if: github.event.pull_request.draft == false | |
name: Review frontend code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 19.9.0 | |
- name: Install pnpm | |
run: npm install --global pnpm | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
working-directory: frontend | |
- name: Setup reviewdog | |
uses: reviewdog/action-setup@v1 | |
- env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
name: Run tsc | |
run: pnpm exec -- tsc | reviewdog -f=tsc -fail-on-error -filter-mode=nofilter -reporter=github-pr-review | |
working-directory: frontend | |
- name: Run eslint | |
uses: reviewdog/action-eslint@v1 | |
with: | |
eslint_flags: "--ext .js,.ts,.tsx ." | |
fail_on_error: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
filter_mode: nofilter | |
workdir: frontend | |
- name: Run stylelint | |
uses: reviewdog/action-stylelint@v1 | |
with: | |
fail_on_error: true | |
filter_mode: nofilter | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
reporter: github-pr-review | |
stylelint_input: "**/*.scss" | |
workdir: frontend | |
run-tests: | |
environment: testing | |
if: github.event.pull_request.draft == false | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 19.9.0 | |
- name: Install pnpm | |
run: npm install --global pnpm | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
working-directory: frontend | |
- name: Copy env file | |
run: cp .env.example .env | |
- name: Set up docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract backend metadata for docker | |
id: meta-backend | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/backend | |
tags: type=raw,value=development | |
- name: Extract frontend metadata for docker | |
id: meta-frontend | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/frontend | |
tags: type=raw,value=development | |
- name: Build backend docker image | |
uses: docker/build-push-action@v4 | |
with: | |
cache-from: scope=test-backend,type=gha | |
cache-to: mode=max,scope=test-backend,type=gha | |
context: backend | |
file: backend/development.Dockerfile | |
load: true | |
tags: ${{ steps.meta-backend.outputs.tags }} | |
- name: Build frontend docker image | |
uses: docker/build-push-action@v4 | |
with: | |
cache-from: scope=test-frontend,type=gha | |
cache-to: mode=max,scope=test-frontend,type=gha | |
context: frontend | |
file: frontend/development.Dockerfile | |
load: true | |
tags: ${{ steps.meta-frontend.outputs.tags }} | |
- name: Pull docker images | |
run: docker compose pull --ignore-buildable | |
- env: | |
DEBUG: ${{ vars.DEBUG }} | |
FRONTEND_BASE_URL: ${{ vars.FRONTEND_BASE_URL }} | |
GOOGLE_CLIENT_ID: ${{ vars.GOOGLE_CLIENT_ID }} | |
REST_API_BASE_URL: ${{ vars.REST_API_BASE_URL }} | |
STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }} | |
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }} | |
STRIPE_WEBHOOK_SIGNING_SECRET: ${{ secrets.STRIPE_WEBHOOK_SIGNING_SECRET }} | |
name: Prepare for backend tests | |
run: | | |
docker compose up --detach clickhouse postgres rabbitmq redis rest-api | |
printf "Waiting for Postgres...\n" | |
docker compose run --rm --entrypoint 'bash -c "wait-for-it -q -s -t 0 "${POSTGRES_HOST}":"${POSTGRES_PORT}" -- echo \"Postgres is ready!\""' rest-api | |
printf "Waiting for ClickHouse...\n" | |
docker compose run --rm --entrypoint 'bash -c "wait-for-it -q -s -t 0 "${CLICKHOUSE_HOST}":"${CLICKHOUSE_TCP_PORT}" -- echo \"ClickHouse is ready!\""' rest-api | |
printf "Waiting for REST API...\n" | |
docker compose run --rm --entrypoint 'bash -c "wait-for-it -q -s -t 0 rest-api:80 -- echo \"REST API is ready!\""' rest-api | |
- name: Run backend tests | |
run: docker compose run --rm rest-api go test ./... 2> /dev/null | |
- env: | |
DEBUG: ${{ vars.DEBUG }} | |
FRONTEND_BASE_URL: ${{ vars.FRONTEND_BASE_URL }} | |
GOOGLE_CLIENT_ID: ${{ vars.GOOGLE_CLIENT_ID }} | |
REST_API_BASE_URL: ${{ vars.REST_API_BASE_URL }} | |
STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }} | |
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }} | |
STRIPE_WEBHOOK_SIGNING_SECRET: ${{ secrets.STRIPE_WEBHOOK_SIGNING_SECRET }} | |
name: Prepare for frontend tests | |
run: | | |
docker compose down | |
docker volume prune --force | |
docker compose up --detach | |
docker compose run --rm --entrypoint 'bash -c "wait-for-it -q -s -t 0 "${POSTGRES_HOST}":"${POSTGRES_PORT}" -- echo \"Postgres is ready!\""' rest-api | |
docker compose run --rm --entrypoint 'bash -c "wait-for-it -q -s -t 0 "${CLICKHOUSE_HOST}":"${CLICKHOUSE_TCP_PORT}" -- echo \"ClickHouse is ready!\""' rest-api | |
docker compose run --rm --entrypoint 'bash -c "wait-for-it -q -s -t 0 rest-api:80 -- echo \"REST API is ready!\""' rest-api | |
curl --fail --max-time 60 --output /dev/null --show-error --silent ${{ vars.FRONTEND_BASE_URL }} && echo "Frontend is ready!" | |
- name: Install Google Chrome | |
run: pnpm exec -- playwright install chrome | |
working-directory: frontend | |
- env: | |
FRONTEND_BASE_URL: ${{ vars.FRONTEND_BASE_URL }} | |
MAILPIT_BASE_URL: ${{ vars.MAILPIT_BASE_URL }} | |
name: Run Playwright tests | |
run: pnpm exec -- playwright test --project="Google Chrome" --workers 1 | |
working-directory: frontend | |
- if: always() | |
name: Prune | |
run: | | |
docker compose down --volumes | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: frontend/playwright-report/ | |
retention-days: 30 |