-
Notifications
You must be signed in to change notification settings - Fork 156
140 lines (123 loc) · 4.68 KB
/
migration.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
name: Datastore Migration
# For details on this workflow, refer to build/migration/README.md
env:
VERSION_TAGS: "['4.9.2', '4.10.2', '4.11.1']"
on:
pull_request:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
paths:
- '.github/workflows/migration.yml'
- 'build/migration/**'
- 'fhir-database-utils/**'
- 'fhir-persistence-schema/**'
- '!fhir-persistence-schema/docs/**'
- '!**.md'
# allows the workflow to be manually executed any time
workflow_dispatch:
inputs:
version_tag:
description: 'Version tag to test migration from (e.g. 4.10.2) or blank for the default matrix'
type: string
jobs:
setup:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'ci-skip')"
steps:
- id: set-matrix
run: |
tag=${{github.event.inputs.version_tag}}
if [ -z ${tag} ]; then
echo "::set-output name=version_tag::${VERSION_TAGS}]"
else
echo "::set-output name=version_tag::['${tag}']"
fi
outputs:
version_tag: ${{ steps.set-matrix.outputs.version_tag }}
migration:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
datastore: [ 'postgres' ]
release: ${{fromJSON(needs.setup.outputs.version_tag)}}
fail-fast: false
steps:
- name: Checkout source code for main
uses: actions/[email protected]
with:
path: fhir/
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch the target branch
run: |
# the target branch of the PR or "main" if its not a PR (e.g. when manually invoked)
TARGET_BRANCH=${GITHUB_BASE_REF:-main}
cd fhir/
git fetch --no-tags --prune --depth=1 origin +refs/heads/${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}
- name: Set up java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Gather the environment details
if: always()
run: |
bash fhir/build/common/gather-environment-details.sh
- name: Checkout source code for previous
uses: actions/[email protected]
with:
path: prev/
ref: ${{ matrix.release }}
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup previous release environment
env:
WORKSPACE: ${{ github.workspace }}
run: |
bash fhir/build/migration/bin/1_previous-setup.sh ${{matrix.datastore}}
- name: Setup docker-compose and database
env:
WORKSPACE: ${{ github.workspace }}
run: |
bash fhir/build/migration/bin/2_compose.sh ${{matrix.datastore}} ${{ matrix.release }}
- name: Run previous release's Integration Tests
env:
WORKSPACE: ${{ github.workspace }}
run: |
bash fhir/build/migration/bin/2_previous-integration-test.sh ${{matrix.datastore}}
bash fhir/build/migration/bin/3_previous-teardown.sh ${{matrix.datastore}}
- name: Migrate to the current release
if: "!contains(env.migration_skip, 'true')"
env:
WORKSPACE: ${{ github.workspace }}
run: |
bash fhir/build/migration/bin/4_current-migrate.sh ${{matrix.datastore}}
- name: Run LATEST Integration Tests
if: "!contains(env.migration_skip, 'true')"
env:
WORKSPACE: ${{ github.workspace }}
run: |
bash fhir/build/migration/bin/5_current-pre-integration-test.sh ${{matrix.datastore}} ${{ matrix.release }}
bash fhir/build/migration/bin/6_current-reindex.sh ${{matrix.datastore}}
bash fhir/build/migration/bin/7_current-integration-test.sh ${{matrix.datastore}}
- name: Teardown and cleanup
if: "!contains(env.migration_skip, 'true')"
env:
WORKSPACE: ${{ github.workspace }}
run: |
bash fhir/build/migration/bin/8_teardown.sh ${{matrix.datastore}}
- name: Gather error logs
if: always()
env:
WORKSPACE: ${{ github.workspace }}/fhir
run: bash fhir/build/common/gather-posttest-logs.sh migration ${{matrix.datastore}}
- name: Upload logs
if: always()
uses: actions/[email protected]
with:
name: integration-test-results-${{ matrix.datastore }}-${{ matrix.release }}
path: fhir/build/migration/integration-test-results
concurrency:
group: migration-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true