-
Notifications
You must be signed in to change notification settings - Fork 5
188 lines (184 loc) · 6.45 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
name: main
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 6 * * *"
defaults:
run:
shell: bash
env:
# Misc.
CI_SKIP_WIN_SERVICES: 1
# dotnet
rdmp-cli-dir: "./rdmp-cli"
db-password: "YourStrongPassw0rd"
# java
java-version: 11
java-distribution: temurin
# python
python-version: 3.6
jobs:
init:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
build_ref: ${{ steps.build_ref.outputs.build_ref }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: set matrix
id: matrix
run: |
set -euxo pipefail
matrix="$(jq --compact-output . .github/workflows/envs.json)"
echo $matrix
echo "matrix=$matrix" >> $GITHUB_OUTPUT
- name: set build ref
id: build_ref
run: |
set -euxo pipefail
build_ref="$GITHUB_REF_NAME"
[ "$GITHUB_REF_TYPE" != "tag" ] && build_ref="${GITHUB_SHA:0:6}"
echo "build_ref=$build_ref" >> $GITHUB_OUTPUT
- name: run ./bin/checkDocs.py
run: ./bin/checkDocs.py
smi:
needs: [init]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.init.outputs.matrix) }}
runs-on: ${{ matrix.image }}
steps:
- name: "[linux] enable disk caching"
if: ${{ matrix.os == 'linux' }}
run: sudo apt-get install -y libeatmydata1
- name: checkout
uses: actions/checkout@v4
- name: setup .NET
# NOTE(rkm 2022-02-20) Uses global.json
uses: actions/[email protected]
- name: download tessdata
run: ./bin/smi/downloadTessdata.py
- name: "[linux] start services"
if: ${{ matrix.os == 'linux' }}
run: ./bin/smi/startDockerLinux.py ${{ env.db-password }}
- name: "[linux] re-write database strings"
if: ${{ matrix.os == 'linux' }}
run: |
set -euxo pipefail
echo "rdmp_conn_str=localhost -u sa -p ${{ env.db-password }}" >> $GITHUB_ENV
./bin/smi/writeDatabaseStrings.py localhost "${{ env.db-password }}"
- name: "[linux] set RDMP version"
if: ${{ matrix.os == 'linux' }}
run: |
set -euxo pipefail
rdmp_cli_ver=$(grep -F -m1 HIC.RDMP.Plugin Directory.Packages.props | sed -n 's/.*Version="\([0-9.]*\)".*/\1/p')
echo "rdmp_cli_ver=$rdmp_cli_ver" >> $GITHUB_ENV
- name: "[linux] download rdmp-cli"
if: ${{ matrix.os == 'linux' }}
run: |
curl -L https://github.com/HicServices/RDMP/releases/download/v${{ env.rdmp_cli_ver }}/rdmp-${{ env.rdmp_cli_ver }}-cli-linux-x64.tar.xz | tar xJf -
mv rdmp-${{ env.rdmp_cli_ver }}-cli-linux rdmp-cli
- name: "[linux] install RDMP databases"
if: ${{ matrix.os == 'linux' }}
run: ${{ env.rdmp-cli-dir }}/rdmp install --createdatabasetimeout 180 ${{ env.rdmp_conn_str }} TEST_
- name: show dotnet info
run: dotnet --info
- name: build, test, and package dotnet
run: |
set -euxo pipefail
cov=""
[ "${{ matrix.os }}" == "windows" ] && cov="--no-coverage"
./bin/smi/buildTestPackage.py \
${{ needs.init.outputs.build_ref }} \
"$cov"
- name: upload coverage to codecov
if: ${{ matrix.os == 'linux' }}
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage/
fail_ci_if_error: true
- name: upload dist as artifact
uses: actions/upload-artifact@v4
with:
name: SmiServices-${{ needs.init.outputs.build_ref }}-smi-${{ matrix.os }}.zip
path: dist/${{ needs.init.outputs.build_ref }}/*
if-no-files-found: error
- name: upload coverage as artifact
if: ${{ matrix.os == 'linux' }}
uses: actions/upload-artifact@v4
with:
name: SmiServices-${{ needs.init.outputs.build_ref }}-smi-${{ matrix.os }}-coverage
path: coverage/*
if-no-files-found: error
ctp:
needs: [init]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.init.outputs.matrix) }}
runs-on: ${{ matrix.image }}
steps:
- name: "[linux] enable disk caching"
if: ${{ matrix.os == 'linux' }}
run: sudo apt-get install -y libeatmydata1
- name: checkout
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: ${{ env.java-version }}
distribution: ${{ env.java-distribution }}
cache: maven
- name: "[linux] start services"
if: ${{ matrix.os == 'linux' }}
run: ./bin/ctp/startDockerLinux.py
- name: "[windows] skip integration tests"
if: ${{ matrix.os == 'windows' }}
run: echo "JAVA_TESTS=--skip-integration-tests" >> $GITHUB_ENV
- name: build, test, and package ctp
run: ./bin/ctp/buildTestPackage.py --install-libs ${{ needs.init.outputs.build_ref }} ${{ env.JAVA_TESTS }}
- name: "[linux] upload packages"
if: ${{ matrix.os == 'linux' }}
uses: actions/upload-artifact@v4
with:
name: SmiServices-${{ needs.init.outputs.build_ref }}-ctp.zip
path: dist/${{ needs.init.outputs.build_ref }}/*
if-no-files-found: error
upload-to-release:
if: contains(github.ref, 'refs/tags/v')
needs: [init, smi, ctp]
runs-on: ubuntu-20.04
steps:
- name: "[linux] enable disk caching"
run: sudo apt-get install -y libeatmydata1
- name: checkout
uses: actions/checkout@v4
- name: download artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
- name: prepare artifacts for release
run: |
set -euxo pipefail
dist_dir=./dist
[ ! -d "$dist_dir" ] && { echo "No artifacts downloaded"; exit 1; }
mkdir ./release
sed -i 's/\r$//' $dist_dir/*/MD5SUM*
cat $dist_dir/*/MD5SUM* >> ./release/MD5SUMS.txt
rm $dist_dir/*/MD5SUM*
cp $dist_dir/*/* ./release/
cd ./release
md5sum -c MD5SUMS.txt
cd ..
./bin/release/createReleaseChangelog.py ${{ needs.init.outputs.build_ref }}
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: ./release/*
body_path: release_changelog.md
fail_on_unmatched_files: true
generate_release_notes: true