-
-
Notifications
You must be signed in to change notification settings - Fork 9
119 lines (116 loc) · 4.07 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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 }}