chore(): pin yarn v3.8.6 #1115
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.svc-consents | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/backend.svc-consents.yaml | |
- packages/backend/svc-consents/** | |
- packages/backend/tsconfig-backend.json | |
- package.json | |
- tsconfig.json | |
- types/**/*.ts | |
- '!**.md' | |
- '!**/.gitignore' | |
pull_request: | |
paths: | |
- .github/workflows/backend.svc-consents.yaml | |
- packages/backend/svc-consents/** | |
- packages/backend/tsconfig-backend.json | |
- package.json | |
- tsconfig.json | |
- types/**/*.ts | |
- '!**.md' | |
- '!**/.gitignore' | |
workflow_dispatch: null | |
env: | |
DOCKER_CONTEXT_PATH: . | |
DOCKERFILE: packages/backend/Dockerfile | |
PACKAGE: svc-consents | |
jobs: | |
test_unit: | |
name: Build, Lint, and Unit Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16] | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@master | |
- name: Using node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@master | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install yarn | |
run: yarn install --immutable | |
- name: Build package | |
run: yarn workspace $PACKAGE build | |
- name: Lint package | |
run: yarn workspace $PACKAGE lint | |
- name: Run package unit tests | |
run: yarn workspace $PACKAGE test:unit | |
test_integration: | |
name: Test Integration | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16] | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@master | |
- name: Copy db init scripts | |
run: | | |
sudo mkdir -p /home/db/scripts | |
sudo cp -r ${{ github.workspace }}/db/scripts/* /home/db/scripts/ | |
sudo chmod 777 /home/db/scripts | |
- name: Using node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@master | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install yarn | |
run: yarn install --immutable | |
- name: Run package integration tests | |
run: yarn workspace $PACKAGE test:integration:ci | |
services: | |
postgres: | |
image: postgres:14-alpine | |
env: | |
POSTGRES_DB: granite | |
POSTGRES_PORT: 5432 | |
POSTGRES_PASSWORD: masterkey | |
POSTGRES_USER: granite | |
ports: | |
- 5432:5432 | |
options: >- | |
-v /home/db/scripts:/docker-entrypoint-initdb.d | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
TYPEORM_HOST: 0.0.0.0 | |
TYPEORM_PORT: 5432 | |
TYPEORM_DATABASE: granite | |
TYPEORM_SCHEMA: public | |
TYPEORM_USERNAME: granite | |
TYPEORM_PASSWORD: masterkey | |
docker: | |
if: github.ref == 'refs/heads/main' | |
name: docker build and publish | |
runs-on: ubuntu-latest | |
needs: | |
- test_unit | |
- test_integration | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@master | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: nicolaspearson | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push latest version | |
uses: docker/build-push-action@master | |
with: | |
build-args: | | |
GITHUB_SHA=${{ github.sha }} | |
PACKAGE=${{ env.PACKAGE }} | |
cache-from: type=registry,ref=ghcr.io/nicolaspearson/${{ env.PACKAGE }} | |
cache-to: type=inline | |
context: ${{ env.DOCKER_CONTEXT_PATH }} | |
file: ${{ env.DOCKERFILE }} | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
ghcr.io/nicolaspearson/${{ env.PACKAGE }}:latest | |
ghcr.io/nicolaspearson/${{ env.PACKAGE }}:${{ github.sha }} |