Skip to content

CI

CI #553

Workflow file for this run

name: CI
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# This workflow is triggered on pushes & pull requests
on:
pull_request:
branches:
- main
push:
branches: [ main ]
release:
types: [published]
schedule:
# Run every day at midnight
- cron: '0 0 * * *'
jobs:
test-js:
name: Test JS
runs-on: ubuntu-latest
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
PW_ONEMEDICAL_USERNAME: ${{ secrets.PW_ONEMEDICAL_USERNAME }}
PW_ONEMEDICAL_PASSWORD: ${{ secrets.PW_ONEMEDICAL_PASSWORD }}
PW_PRACTICEFUSION_USERNAME: ${{ secrets.PW_PRACTICEFUSION_USERNAME }}
PW_PRACTICEFUSION_PASSWORD: ${{ secrets.PW_PRACTICEFUSION_PASSWORD }}
PW_MAXIMEYES_USERNAME: ${{ secrets.PW_MAXIMEYES_USERNAME }}
PW_MAXIMEYES_PASSWORD: ${{ secrets.PW_MAXIMEYES_PASSWORD }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 21
registry-url: 'https://registry.npmjs.org'
- name: Checkout
uses: actions/checkout@v2
- name: Test
run: |
make test-js
test-go:
name: Test Go
runs-on: ubuntu-latest
container: ghcr.io/packagrio/packagr:latest-golang
env:
STATIC: true
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Test
run: |
go install github.com/golang/mock/mockgen@v1.6.0
go generate ./...
go test -coverprofile=coverage.txt -covermode=atomic -v ./...
- name: Archive coverage
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: coverage
path: ${{ github.workspace }}/coverage.txt
retention-days: 1
- name: Upload coverage report
uses: codecov/codecov-action@v4
if: always()
with:
files: ${{ github.workspace }}/coverage.txt
flags: unittests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true
docker:
if: always()
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
# only latest if push has a tag and we're building the "main" flavor
latest=${{ github.event_name == 'release' && github.ref_type == 'tag' }}
tags: |
# if this is a tag'd build, prefix it with the flavor (eg. main-v1.2.3 and sandbox-v1.2.3)
type=ref,event=tag
# if this is a main branch build, just tag it with the flavor (eg. main and sandbox)
type=raw,value=${{ github.ref_name }},enable=${{ github.ref_name == 'main' }}
# if this is a (non main) branch build, tag it with the flavor and branch name (eg. main-branch and sandbox-branch)
type=ref,event=branch,enable=${{ github.ref_name != 'main' }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}