-
Notifications
You must be signed in to change notification settings - Fork 4
169 lines (131 loc) · 4.53 KB
/
main.yml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI/CD
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
SHR_VERSION: ci
jobs:
unit-test:
timeout-minutes: 20
permissions:
contents: read
packages: write
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Yarn
run: yarn install
- name: Build
run: yarn tsc
- name: Run Jest Tests
run: yarn test:unit
build-test-push:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Change repo info to lowercase
id: string
uses: ASzc/change-string-case-action@v5
with:
string: ${{ github.repository }}
- name: Get Package Version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Check custom tag
run: echo ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:${{steps.package-version.outputs.current-version}}
- name: Build SHR
uses: docker/build-push-action@v3
with:
tags: ghcr.io/i-tech-uw/shared-health-record:ci
push: false
load: true
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Pull containers
# run: docker-compose pull shr-fhir openhim-core mongo-db newman kafka zookeeper
# - name: Cache containers
# uses: satackey/[email protected]
# continue-on-error: true
# - name: Start containers
# run: docker-compose up -d shr-fhir mongo-db openhim-core kafka zookeeper
# - name: Load openhim config
# run: docker-compose up -d openhim-config
# - name: Sleep for 60 seconds
# run: sleep 90s
# shell: bash
# - name: Display docker logs for openhim config
# run: docker-compose logs openhim-config
# - name: Run SHR image
# run: docker-compose up -d shr
# - name: Sleep for 30 seconds
# run: sleep 30s
# shell: bash
# - name: Show SHR Log
# run: docker-compose logs shr
# - name: Show kafka Log
# run: docker-compose logs kafka
# - name: Check openhim-core
# run: curl -sSk https://localhost:8080/heartbeat
# - name: Show containers
# run: docker-compose ps
# - name: Show OpenHIM Log
# run: docker-compose logs openhim-core
# # Postman Testing - see https://www.postman.com/itechuw/workspace/shared-health-record/
# - name: Run General Tests Collection
# env:
# POSTMAN_COLLECTION: /.postman/collections/1_general_tests.json
# run: docker-compose up -d newman
# - name: Run Laboratory Workflows Collection (collection/1525496-f28b488f-a40c-4723-8a72-a2b4f64bb5da)
# env:
# POSTMAN_COLLECTION: /.postman/collections/2_laboratory_workflows.json
# run: docker-compose up --exit-code-from newman newman
# continue-on-error: true
# - name: Run MLLP Tests
# run: docker-compose up --exit-code-from mllp_tests mllp_tests
# - name: Show SHR Log
# if: always()
# run: docker-compose logs shr
# - name: Show kafka Log
# if: always()
# run: docker-compose logs kafka
# - name: Stop containers
# if: always()
# run: docker-compose down
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Docker image
uses: docker/build-push-action@v3
if: github.event_name == 'release'
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }},${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:${{steps.package-version.outputs.current-version}}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max