CI pipeline #1705
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: CI pipeline | |
on: | |
schedule: | |
- cron: '0 10 * * *' # every day at 10am | |
push: | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.11.0' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Save build folder | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
if-no-files-found: error | |
path: node_modules | |
lint: | |
runs-on: ubuntu-latest | |
needs: install | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.11.0' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Lint | |
run: yarn eslint src | |
test: | |
runs-on: ubuntu-latest | |
needs: install | |
name: E2E Tests | |
strategy: | |
matrix: | |
browser: ["chrome", "electron"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download the build folder | |
uses: actions/download-artifact@v4 | |
with: | |
name: build | |
- name: Checkout another repository | |
uses: actions/checkout@v4 | |
with: | |
repository: bbmri-eric/negotiator | |
ref: master | |
path: negotiator | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup API server | |
run: cd negotiator && docker compose up -d negotiator oidc-server-mock | |
- name: Wait | |
run: sleep 30 | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
start: yarn dev | |
browser: ${{ matrix.browser }} | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: ./cypress/screenshots | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
bbmrieric/negotiator-frontend | |
tags: | | |
type=ref,event=branch | |
type=raw,value=${{ github.head_ref }},event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max,inline=true |