Merge pull request #146 from DiSSCo/SmokeTestingFixes #623
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: Build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- image: public.ecr.aws/dissco/${{ github.event.repository.name }}-production | |
keycloak_client: production-disscover-fe | |
- image: public.ecr.aws/dissco/${{ github.event.repository.name }} | |
keycloak_client: orchestration-service | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Install Dependencies | |
run: npm install | |
- name: Test and Coverage | |
run: npm run test:coverage | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Login to Public ECR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: public.ecr.aws | |
username: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ matrix.image }} | |
tags: | | |
type=sha | |
type=raw,value=latest | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
"VITE_KEYCLOAK_CLIENT=${{ matrix.keycloak_client }}" | |
- name: Set outputs | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Push tag | |
if: github.event_name != 'pull_request' | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CUSTOM_TAG: sha-${{ steps.vars.outputs.sha_short }}-${{ matrix.keycloak_client }} |