updated readme #28
Workflow file for this run
This file contains hidden or 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
on: | |
push: | |
branches: | |
- develop | |
- main | |
pull_request: | |
branches: ["**"] | |
types: [opened, reopened, edited] | |
tags: | |
- "*" | |
workflow_dispatch: | |
inputs: | |
environment: | |
required: true | |
default: "mango_ui" | |
jobs: | |
test_mango_ui: | |
name: Test MANGO UI | |
environment: mango_ui | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo content | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.18 | |
- name: Install dependencies | |
run: | | |
npm ci | |
npx playwright install --with-deps | |
shell: bash | |
- name: Import certificates and keys | |
run: | | |
mkdir -p .cert | |
echo "${{ secrets.KEY }}" > .cert/key.pem | |
echo "${{ secrets.CERTIFICATE }}" > .cert/cert.pem | |
chmod 600 .cert/key.pem .cert/cert.pem | |
shell: bash | |
- name: Build application | |
run: npm run build | |
- name: Run lint | |
run: | | |
npm run lint | |
npm run lint:css | |
shell: bash | |
- name: Run unit tests | |
run: npm run test:unit | |
- name: Run e2e tests | |
run: npx playwright test | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: e2e-test-results | |
path: e2e-test-results/ | |
retention-days: 2 # limit imposed by GitHub organization | |
build_docker_image: | |
name: Build Docker Image | |
environment: mango_ui | |
runs-on: ubuntu-latest | |
needs: [test_mango_ui] | |
if: | | |
needs.test_mango_ui.result == 'success' && | |
( | |
github.ref == 'refs/heads/develop' || | |
startsWith(github.ref, 'refs/tags/') | |
) | |
steps: | |
- name: Checkout repo content | |
uses: actions/checkout@v4 | |
- name: Inject certificates and keys | |
run: | | |
mkdir -p .cert | |
echo "${{ secrets.KEY }}" > .cert/key.pem | |
echo "${{ secrets.CERTIFICATE }}" > .cert/cert.pem | |
chmod 600 .cert/key.pem .cert/cert.pem | |
shell: bash | |
- name: Create env variable of lowercase GitHub repo name | |
run: | | |
GITHUB_REPO_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') | |
echo "GITHUB_REPO_LOWER=$GITHUB_REPO_LOWER" >>${GITHUB_ENV} | |
shell: bash | |
- name: Set docker tag environment variable | |
run: | | |
GITHUB_REF_NAME_CLEAN="${GITHUB_REF_NAME//\//_}" | |
DOCKER_TAG="ghcr.io/${{ env.GITHUB_REPO_LOWER }}:${GITHUB_REF_NAME_CLEAN}" | |
echo "DOCKER_TAG=$DOCKER_TAG" >>${GITHUB_ENV} | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- name: Build and push algorithm Docker image | |
id: push-algorithm | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
tags: ${{ env.DOCKER_TAG }} |