This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
forked from ldsec/geco-i2b2-data-source
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.27 KB
/
ci-cd.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
name: Build and test TI Note i2b2 data source
on:
push:
workflow_dispatch:
jobs:
ci-cd:
name: Build and test TI Note i2b2 data source
runs-on: ubuntu-latest
env:
PUSH: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true
cache-dependency-path: go.sum
- name: Environment
run: |
go version
./scripts/version.sh
env
- name: Go sources beautification
run: make go-imports go-lint
- name: Build data source plugin
run: make go-build-plugin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Get versions
id: get_versions
run: |
DATASOURCE_VERSION=$(scripts/version.sh)
echo ::set-output name=datasource_version::${DATASOURCE_VERSION}
echo ::set-output name=i2b2_docker_image::ghcr.io/tuneinsight/i2b2-geco:${DATASOURCE_VERSION}
- name: Build i2b2 Docker image
uses: docker/build-push-action@v2
with:
context: ./build/package/i2b2
load: true
tags: ${{ steps.get_versions.outputs.i2b2_docker_image }}
cache-from: type=gha,scope=buildkit
cache-to: type=gha,scope=buildkit,mode=max
- name: Start i2b2 + DB
run: make i2b2-docker-compose ARGS="up -d"
- name: Run i2b2 docker image test
run: |
sudo apt-get update && sudo apt-get install -y libxml2-utils
make i2b2-test
- name: Run go unit tests
run: make go-unit-tests
- name: Show i2b2 deployment logs (only in case of failure)
if: failure()
run: make i2b2-docker-compose ARGS="logs"
- name: Login to GitHub Container Registry
if: ${{ env.PUSH == 'true' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push i2b2 Docker image
if: ${{ env.PUSH == 'true' }}
run: docker push ${{ steps.get_versions.outputs.i2b2_docker_image }}