Use pnpm instead of npm, update deps, refacto migration + engine #26
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Continuous integration workflow | |
on: | |
push: | |
branches: | |
- next | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
# | |
# Quality section | |
# | |
## Package i18n | |
i18n-check-keys: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/i18n | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run script to check keys in translation files | |
run: | | |
chmod +x ./compareKeyTranslation.sh | |
./compareKeyTranslation.sh | |
shell: bash | |
## Design system | |
# design-system-quality: | |
# runs-on: ubuntu-latest | |
# container: node:18 | |
# defaults: | |
# run: | |
# working-directory: packages/designsystem | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: NPM Version | |
# run: pnpm -v | |
# - name: Install dependencies | |
# run: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true pnpm i | |
# - name: lint | |
# run: pnpm run lint | |
# env: | |
# NODE_OPTIONS: --max_old_space_size=4096 | |
## nuxt-locokit | |
# nuxt-locokit-quality: | |
# nuxt-locokit-build: | |
## app part | |
# app-quality: | |
# app-build: | |
# app-docker: | |
## api | |
api-quality: | |
runs-on: ubuntu-latest | |
container: node:18 | |
env: | |
LCK_PORT: 3030 | |
LCK_HOST: localhost | |
LCK_DATABASE_URL: postgres://postgres:yourPostgresPassword@lck-db:5432/postgres | |
LCK_PUBLIC_PORTAL_NAME: LCK_PUBLIC_PORTAL_NAME | |
SIGNUP_MAIL_DELAY_DAYS: 10 | |
NODE_ENV: test | |
NODE_OPTIONS: --max_old_space_size=4096 | |
services: | |
lck-db: | |
image: postgis/postgis:15-3.3-alpine | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: yourPostgresPassword | |
TZ: 'UTC' | |
PGTZ: 'UTC' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
- name: Install turbo | |
run: npm i -g turbo --ignore-scripts | |
- name: Install dependencies | |
run: pnpm i --ignore-scripts | |
# This is needed for better linting | |
# if packages are not built, we can't lint correctly | |
- name: Build all dependencies for api | |
run: turbo run build --filter=locokit-api | |
- name: Lint code | |
run: pnpm --filter locokit-api lint | |
- name: Prettier | |
run: pnpm --filter locokit-api prettier | |
- name: Unit tests | |
run: pnpm --filter locokit-api vitest:coverage | |
env: | |
NODE_OPTIONS: --max_old_space_size=4096 | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Tar coverage | |
run: tar -cvzf lck-api-quality-artifact.tar.gz api/coverage | |
# - name: SonarCloud Scan | |
# uses: SonarSource/sonarcloud-github-action@master | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Archive production artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lck-api-quality-artifact.tar.gz | |
path: lck-api-quality-artifact.tar.gz | |
## Documentation part | |
docs-build: | |
runs-on: ubuntu-latest | |
container: node:18 | |
env: | |
BASE_URL: '/' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
- name: Install dependencies | |
run: pnpm i --ignore-scripts | |
- name: Build documentation | |
run: pnpm docs:build | |
- name: Tar docs | |
run: cd docs/.vitepress/dist/ && tar -czvf lck-docs-build-artifact.tar.gz * | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lck-docs-build-artifact.tar.gz | |
path: | | |
docs/.vitepress/dist/lck-docs-build-artifact.tar.gz | |
# | |
# Build section | |
# | |
general-build: | |
runs-on: ubuntu-latest | |
container: node:18 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
- name: Install Turbo | |
run: npm i -g turbo --ignore-scripts | |
- name: Install dependencies | |
run: pnpm i --ignore-scripts | |
- name: Build all project | |
run: turbo run build | |
- name: Tar build api | |
run: tar -cvzf lck-api-build-artifact.tar.gz api/dist | |
- name: Tar build app | |
run: tar -cvzf lck-app-build-artifact.tar.gz packages/nuxt-locokit/playground/.output | |
- name: Tar build @locokit/definitions | |
run: tar -cvzf locokit-definitions-build-artifact.tar.gz packages/definitions/dist | |
- name: Tar build @locokit/designsystem | |
run: tar -cvzf locokit-designsystem-build-artifact.tar.gz packages/designsystem/dist | |
- name: Tar build @locokit/engine | |
run: tar -cvzf locokit-engine-build-artifact.tar.gz packages/engine/dist | |
- name: Tar build nuxt-locokit | |
run: tar -cvzf nuxt-locokit-build-artifact.tar.gz packages/nuxt-locokit/dist | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lck-build-artifact-${{ github.sha }} | |
path: | | |
lck-api-build-artifact.tar.gz | |
lck-app-build-artifact.tar.gz | |
locokit-definitions-build-artifact.tar.gz | |
locokit-designsystem-build-artifact.tar.gz | |
locokit-engine-build-artifact.tar.gz | |
nuxt-locokit-build-artifact.tar.gz | |
docker-api-build: | |
runs-on: ubuntu-latest | |
needs: general-build | |
# strategy: | |
# matrix: | |
# platform: [linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: lck-build-artifact-${{ github.sha }} | |
- name: List files | |
run: ls -al | |
- name: Extract build api | |
run: tar -xzf lck-api-build-artifact.tar.gz | |
- name: Extract build @locokit/definitions | |
run: tar -xzf locokit-definitions-build-artifact.tar.gz | |
- name: Extract build @locokit/engine | |
run: tar -xzf locokit-engine-build-artifact.tar.gz | |
- name: List files | |
run: ls -al api | |
- name: List files | |
run: ls -al packages/definitions | |
- name: List files | |
run: ls -al packages/engine | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Print GITHUB REF | |
run: echo $GITHUB_REF | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: metapi | |
uses: docker/metadata-action@v3 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
locokit/api | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build and push locokit/api | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./DockerfileGHA | |
push: true | |
tags: ${{ steps.metapi.outputs.tags }} | |
target: locokit-api | |
labels: ${{ steps.metapi.outputs.labels }} | |
# platforms: ${{ matrix.platform }} | |
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
docker-app-build: | |
runs-on: ubuntu-latest | |
needs: general-build | |
# strategy: | |
# matrix: | |
# platform: [linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: lck-build-artifact-${{ github.sha }} | |
- name: List files | |
run: ls -al | |
- name: Extract build app | |
run: tar -xzf lck-app-build-artifact.tar.gz | |
- name: List files | |
run: ls -al packages/nuxt-locokit/playground/.output | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Print GITHUB REF | |
run: echo $GITHUB_REF | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: metapp | |
uses: docker/metadata-action@v3 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
locokit/app | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build and push locokit/app | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./DockerfileGHA | |
push: true | |
tags: ${{ steps.metapp.outputs.tags }} | |
target: locokit-app | |
labels: ${{ steps.metapp.outputs.labels }} | |
# platforms: ${{ matrix.platform }} | |
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |