Skip to content

Merge pull request #2006 from Bahati308/testName-fix #58

Merge pull request #2006 from Bahati308/testName-fix

Merge pull request #2006 from Bahati308/testName-fix #58

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Run E2E Tests and Publish Docker Images
on:
push:
branches: [develop]
release:
types: [published]
workflow_dispatch:
env:
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
DOCKER_NAME: ${{ vars.DOCKERHUB_USERNAME }}/openelis-global-2
DOCKER_TEST_NAME: ${{ vars.DOCKERHUB_USERNAME }}/openelis-global-2-test
jobs:
# build-and-push-test-image-backend:
# if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# submodules: recursive
# # Add support for more platforms with QEMU (optional)
# # https://github.com/docker/setup-qemu-action
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Login to DockerHub
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.DOCKER_TEST_NAME }}
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# # cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache
# # cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache,mode=max
# build-args: SKIP_SPOTLESS=true
# build-and-push-test-image-frontend:
# if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# # Add support for more platforms with QEMU (optional)
# # https://github.com/docker/setup-qemu-action
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Log in to the Container registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.DOCKER_TEST_NAME }}-frontend
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: ./frontend
# file: ./frontend/Dockerfile.prod
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# # cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache
# cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache,mode=max
# build-and-push-test-image-proxy:
# if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# # Add support for more platforms with QEMU (optional)
# # https://github.com/docker/setup-qemu-action
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Log in to the Container registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.DOCKER_TEST_NAME }}-proxy
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: ./nginx-proxy
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# # cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache
# cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-proxy:buildcache,mode=max
# build-and-push-test-image-fhir:
# if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# # Add support for more platforms with QEMU (optional)
# # https://github.com/docker/setup-qemu-action
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Log in to the Container registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.DOCKER_TEST_NAME }}-fhir
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: ./fhir
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# # cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache
# cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-fhir:buildcache,mode=max
# run-e2e-qa:
# needs:
# [build-and-push-test-image-backend, build-and-push-test-image-frontend]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout OpenELIS-Global2
# uses: actions/checkout@v4
# with:
# repository: ${{github.repository}}
# - name: Run OpenELIS image
# run: docker compose -f test.docker-compose.yml up -d --build --wait --wait-timeout 300
# - name: Cypress run
# uses: cypress-io/github-action@v6
# with:
# working-directory: frontend
# env:
# CYPRESS_STARTUP_WAIT_MILLISECONDS: 300000
# CYPRESS_VIDEO: false
# - name: Dump docker logs on failure
# if: failure()
# uses: jwalton/gh-docker-logs@v2
# with:
# # Only show last 100 lines of each
# tail: "100"
frontend-qa:
if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
uses: DIGI-UW/OpenELIS-Global-2/.github/workflows/frontend-qa.yml@develop
build-and-push-image-backend:
if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
needs: [frontend-qa]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache
# cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}:buildcache,mode=max
build-args: SKIP_SPOTLESS=true
build-and-push-image-frontend:
if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
needs: [frontend-qa]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_NAME }}-frontend
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./frontend
file: ./frontend/Dockerfile.prod
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache,mode=max
build-and-push-image-proxy:
if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
needs: [frontend-qa]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_NAME }}-proxy
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./nginx-proxy
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-proxy:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-proxy:buildcache,mode=max
build-and-push-image-fhir:
if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' }}
needs: [frontend-qa]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_NAME }}-fhir
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./fhir
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-fhir:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-fhir:buildcache,mode=max
build-installer-and-upload-installer:
if: ${{ github.repository == 'DIGI-UW/OpenELIS-Global-2' && github.event_name == 'release' && github.event.action == 'published' }}
needs: [frontend-qa]
uses : DIGI-UW/OpenELIS-Global-2/.github/workflows/build-installer.yml@develop