Merge pull request #171 from codeanker/feature/mjml #832
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: [development, master] | |
pull_request: | |
branches: [development, master] | |
jobs: | |
lint: | |
name: ✨ Lint | |
runs-on: ubuntu-latest | |
container: node:20-bullseye | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
name: List the state of node modules | |
continue-on-error: true | |
run: npm list | |
- run: npm ci | |
- run: npm run lint | |
prepare: | |
name: 🔨 Initialisieren | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.prop }} | |
commit: ${{ steps.set-commit.outputs.commit }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: get version | |
id: version | |
uses: notiz-dev/[email protected] | |
with: | |
path: 'package.json' | |
prop_path: 'version' | |
- name: set commit | |
id: set-commit | |
run: echo "commit=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | |
# build and upload docker image to github container registry | |
build: | |
name: 🏗️ Build | |
needs: prepare | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/codeanker/brahmsee.digital | |
tags: type=sha,prefix= | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
commitHash=${{needs.prepare.outputs.commit}} | |
version=${{needs.prepare.outputs.version}} | |
mode=${{ env.MODE }} | |
typecheck: | |
name: 🙆♀️ Typecheck | |
runs-on: ubuntu-latest | |
container: node:20-bullseye | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
name: List the state of node modules | |
continue-on-error: true | |
run: npm list | |
- run: npm ci | |
- run: npm run typecheck | |
# test: | |
# name: 🧪 Test | |
# runs-on: ubuntu-latest | |
# container: node:20-bullseye | |
# services: | |
# postgres: | |
# image: postgres | |
# env: | |
# POSTGRES_USER: postgres | |
# POSTGRES_PASSWORD: postgres | |
# POSTGRES_DB: brahmsee.digital | |
# options: >- | |
# --health-cmd pg_isready | |
# --health-interval 10s | |
# --health-timeout 5s | |
# --health-retries 5 | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Cache node modules | |
# id: cache-npm | |
# uses: actions/cache@v3 | |
# env: | |
# cache-name: cache-node-modules | |
# with: | |
# # npm cache files are stored in `~/.npm` on Linux/macOS | |
# path: ~/.npm | |
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
# restore-keys: | | |
# ${{ runner.os }}-build-${{ env.cache-name }}- | |
# ${{ runner.os }}-build- | |
# ${{ runner.os }}- | |
# - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
# name: List the state of node modules | |
# continue-on-error: true | |
# run: npm list | |
# - run: npm ci | |
# - run: cp -n api/.env.example api/.env | |
# - name: set test env | |
# run: sed -i 's/NODE_ENV=development/NODE_ENV=test/g' api/.env | |
# - run: npx -w api prisma migrate reset --force | |
# - run: npx playwright install --with-deps | |
# - run: npm run test:all |