Skip to content

Add Scoutable Elements #4701

Add Scoutable Elements

Add Scoutable Elements #4701

Workflow file for this run

name: Complete pipeline
on:
push:
branches:
- main
- dev
- dev-next
pull_request:
# The first three types are the default value (see https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request).
# `ready_for_review` is needed since actions from pipelines (such as the PRs created by the release pipeline) don't trigger additional pipelines.
# Hence, we let the release pipeline create draft PRs that we then can mark as ready manually.
types: [opened, synchronize, reopened, ready_for_review]
env:
NODE_VERSION: '24.13.0'
POSTGRES_USER: dfm
POSTGRES_PASSWORD: notASecurePassword_forPipelineOnly
POSTGRES_DB: dfm_db
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
cache-dependencies:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-install
with:
cache-only: true
download-shared: false
audit-dependencies:
timeout-minutes: 10
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/head/dev') || github.ref == 'refs/head/main'
needs: cache-dependencies
continue-on-error: true
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-install
with:
download-shared: false
- name: Audit root
if: always()
run: npm audit
- name: Audit shared
if: always()
run: cd shared && npm audit
- name: Audit frontend
if: always()
run: cd frontend && npm audit
- name: Audit backend
if: always()
run: cd backend && npm audit
- name: Audit benchmark
if: always()
run: cd benchmark && npm audit
build-docker:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: false # We only build the image to check whether the build succeeds
tags: fuesim-digital
build-shared:
timeout-minutes: 5
runs-on: ubuntu-latest
needs: cache-dependencies
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-install
with:
install-command: cd shared && npm ci --no-audit
download-shared: false
- name: Build shared
run: cd shared && npm run build
- name: Upload shared dist
uses: actions/upload-artifact@v6
with:
name: shared-dist
path: shared/dist
build-frontend:
timeout-minutes: 5
runs-on: ubuntu-latest
needs: build-shared
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-install
with:
install-command: (cd shared && npm ci --no-audit) && (cd frontend && npm ci --no-audit)
- name: Build frontend
run: cd frontend && npm run build
build-backend:
timeout-minutes: 5
runs-on: ubuntu-latest
needs: build-shared
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-install
with:
install-command: (cd shared && npm ci --no-audit) && (cd backend && npm ci --no-audit)
- name: Build backend
run: cd backend && npm run build
lint:
timeout-minutes: 5
runs-on: ubuntu-latest
needs: build-shared
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-install
- name: Run ESLint
run: npm run lint
- name: Run Prettier
if: always()
run: npm run prettier:check
test:
timeout-minutes: 4
runs-on: ubuntu-latest
needs: build-shared
services:
postgres:
image: postgres:18
env:
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
ports:
- 5432/tcp
# Set health checks to wait until postgres has started
# Mount tmpfs as data directory to speed up db operations, tests don't need persistence
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--tmpfs /var/lib/postgresql
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-install
- name: Start Authelia
uses: ./.github/actions/start-authelia
- name: Create .env
run: >
cat ./.env.example
| sed -e "s/^DFM_DB_USER=.*$/DFM_DB_USER=${{ env.POSTGRES_USER }}/"
| sed -e "s/^#DFM_DB_PASSWORD=.*$/DFM_DB_PASSWORD=${{ env.POSTGRES_PASSWORD }}/"
| sed -e "s/^DFM_DB_NAME=.*$/DFM_DB_NAME=${{ env.POSTGRES_DB }}/"
| sed -e "s/^DFM_DB_PORT=.*$/DFM_DB_PORT=${{ job.services.postgres.ports['5432'] }}/"
| sed -e "s/^DFM_DB_HOST=.*$/DFM_DB_HOST=127.0.0.1/"
| sed -e "s|^DFM_AUTH_URL=.*$|DFM_AUTH_URL=http://127.0.0.1:${{ env.AUTHELIA_CONTAINER_PORT }}|"
> ./.env
- name: Run migrations
run: cd backend && npm run migration:run
- name: Run Backend Tests
run: cd backend && npm run test:ci-no-migration
if: always()
- name: Run Frontend Tests
run: cd frontend && npm run test:ci
if: always()
- name: Run Shared Tests
run: cd shared && npm run test:ci
if: always()
- name: Merge coverage
run: npm run merge-coverage
if: always()
- name: Upload coverage
uses: actions/upload-artifact@v6
if: always()
with:
name: coverage-output
path: coverage
migration-test:
timeout-minutes: 4
runs-on: ubuntu-latest
needs: build-shared
services:
postgres:
image: postgres:18
env:
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
ports:
- 5432/tcp
# Set health checks to wait until postgres has started
# Mount tmpfs as data directory to speed up db operations, tests don't need persistence
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--tmpfs /var/lib/postgresql
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: ./.github/actions/setup-install
- name: Start Authelia
uses: ./.github/actions/start-authelia
- name: Create .env
run: >
cat ./.env.example
| sed -e "s/^DFM_DB_USER=.*$/DFM_DB_USER=${{ env.POSTGRES_USER }}/"
| sed -e "s/^#DFM_DB_PASSWORD=.*$/DFM_DB_PASSWORD=${{ env.POSTGRES_PASSWORD }}/"
| sed -e "s/^DFM_DB_NAME=.*$/DFM_DB_NAME=${{ env.POSTGRES_DB }}/"
| sed -e "s/^DFM_DB_PORT=.*$/DFM_DB_PORT=${{ job.services.postgres.ports['5432'] }}/"
| sed -e "s/^DFM_DB_HOST=.*$/DFM_DB_HOST=127.0.0.1/"
| sed -e "s|^DFM_AUTH_URL=.*$|DFM_AUTH_URL=http://127.0.0.1:${{ env.AUTHELIA_CONTAINER_PORT }}|"
> ./.env
- name: Run migrations
run: cd backend && npm run migration:run
- name: Run Migration Tests
run: cd backend && npm run test:ci-migration
cypress:
timeout-minutes: 20
runs-on: ${{ matrix.os }}
needs: build-shared
services:
postgres:
image: postgres:18
env:
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
ports:
- 5432/tcp
# Set health checks to wait until postgres has started
# Mount tmpfs as data directory to speed up db operations, tests don't need persistence
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--tmpfs /var/lib/postgresql
strategy:
matrix:
os: [ubuntu-latest]
browser: [firefox, chromium]
fail-fast: false
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-install
- name: Start Authelia
uses: ./.github/actions/start-authelia
- name: Create .env
run: >
cat ./.env.example
| sed -e "s/^DFM_DB_USER=.*$/DFM_DB_USER=${{ env.POSTGRES_USER }}/"
| sed -e "s/^#DFM_DB_PASSWORD=.*$/DFM_DB_PASSWORD=${{ env.POSTGRES_PASSWORD }}/"
| sed -e "s/^DFM_DB_NAME=.*$/DFM_DB_NAME=${{ env.POSTGRES_DB }}/"
| sed -e "s/^DFM_DB_PORT=.*$/DFM_DB_PORT=${{ job.services.postgres.ports['5432'] }}/"
| sed -e "s/^DFM_DB_HOST=.*$/DFM_DB_HOST=127.0.0.1/"
| sed -e "s|^DFM_AUTH_URL=.*$|DFM_AUTH_URL=http://127.0.0.1:${{ env.AUTHELIA_CONTAINER_PORT }}|"
> ./.env
- name: Run migrations
run: cd backend && npm run migration:run
- name: Run Cypress
uses: cypress-io/github-action@v7
with:
start: npm --prefix .. -- run start:all
working-directory: frontend
install-command: 'npm run cy:install'
package-manager-cache: false # This is handled by actions/setup-node (used internally by our setup-install action)
browser: ${{ matrix.browser }}
wait-on: 'http://127.0.0.1:4200/, http://127.0.0.1:3201/api/health'
wait-on-timeout: 90
command-prefix: '--' # So cypress is using our node version: https://github.com/cypress-io/github-action/issues/489#issuecomment-1021379037
- name: Archive cypress screenshots
if: always()
uses: actions/upload-artifact@v6
with:
name: cypress-screenshots-${{ matrix.browser }}
path: frontend/cypress/screenshots
# Dummy step to gate until all test are complete
tests-done:
if: always()
needs:
- build-docker
- build-shared
- build-frontend
- build-backend
- test
- cypress
- lint
- migration-test
runs-on: ubuntu-latest
steps:
- uses: matrix-org/done-action@v3
with:
needs: ${{ toJSON (needs) }}
deploy-dev:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: tests-done
if: github.ref == 'refs/heads/dev'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
# Source: https://docs.docker.com/ci-cd/github-actions/
- name: Add commit hash to version
uses: ./.github/actions/add-commit-hash-to-version
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: true
tags: >
${{ secrets.DOCKER_HUB_USERNAME }}/dfm:dev ,
ghcr.io/${{ github.repository }}:dev ,
deploy-dev-next:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: tests-done
if: github.ref == 'refs/heads/dev-next'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
# Source: https://docs.docker.com/ci-cd/github-actions/
- name: Add commit hash to version
uses: ./.github/actions/add-commit-hash-to-version
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: true
tags: >
${{ secrets.DOCKER_HUB_USERNAME }}/dfm:dev-next ,
ghcr.io/${{ github.repository }}:dev-next ,
deploy-main:
timeout-minutes: 10
runs-on: ubuntu-latest
needs: tests-done
if: github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/extract-version
# Source: https://docs.docker.com/ci-cd/github-actions/
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: true
tags: >
${{ secrets.DOCKER_HUB_USERNAME }}/dfm:latest ,
${{ secrets.DOCKER_HUB_USERNAME }}/dfm:${{ env.VERSION_NAME }} ,
ghcr.io/${{ github.repository }}:latest ,
ghcr.io/${{ github.repository }}:${{ env.VERSION_NAME }}
release-main:
timeout-minutes: 2
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: tests-done
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/extract-version
- name: Extract release notes
id: extract_release_notes
uses: ffurrer2/extract-release-notes@v3
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.VERSION_NAME }}
name: v${{ env.VERSION_NAME }}
target_commitish: main
body: ${{ steps.extract_release_notes.outputs.release_notes }}