-
Notifications
You must be signed in to change notification settings - Fork 4
194 lines (162 loc) · 6.37 KB
/
build.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
189
190
191
192
193
194
name: Ataru
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
jobs:
test-cypress:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Europe/Helsinki"
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
# Remove following in the future (and update script in package.json), it installs chrome version 116 as the current 117 has bug
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: 1160321
id: setup-chrome
- run: |
echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }}
echo Installed chromium path: ${{ steps.setup-chrome.outputs.chrome-path }}
which chromium
chromium --version
- name: Prepare tests
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GA_BUILD_NUMBER: ${{ github.run_number }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
docker run -d --name ataru-test-db -p 5433:5432 -e POSTGRES_DB=ataru-test -e POSTGRES_PASSWORD=oph -e POSTGRES_USER=oph 190073735177.dkr.ecr.eu-west-1.amazonaws.com/utility/postgres:11
docker run -d --name ataru-test-redis -p 6380:6379 190073735177.dkr.ecr.eu-west-1.amazonaws.com/utility/redis:5.0
docker run -d --name ataru-test-ftpd -p 2221:21 -p 30000-30009:30000-30009 190073735177.dkr.ecr.eu-west-1.amazonaws.com/utility/hiekkalaatikko:ataru-test-ftpd
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@4.0
with:
lein: 2.9.1
- name: Run Cypress tests
run: |
./bin/cibuild.sh run-browser-tests-cypress
test-spec-and-mocha:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Europe/Helsinki"
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Prepare tests
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GA_BUILD_NUMBER: ${{ github.run_number }}
run: |
sudo apt-get update
sudo apt-get install -y lftp
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
docker run -d --name ataru-test-db -p 5433:5432 -e POSTGRES_DB=ataru-test -e POSTGRES_PASSWORD=oph -e POSTGRES_USER=oph 190073735177.dkr.ecr.eu-west-1.amazonaws.com/utility/postgres:11
docker run -d --name ataru-test-redis -p 6380:6379 190073735177.dkr.ecr.eu-west-1.amazonaws.com/utility/redis:5.0
docker run -d --name ataru-test-ftpd -p 2221:21 -p 30000-30009:30000-30009 190073735177.dkr.ecr.eu-west-1.amazonaws.com/utility/hiekkalaatikko:ataru-test-ftpd
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@4.0
with:
lein: 2.9.1
- name: Run Spec and Mocha tests
run: |
./bin/cibuild.sh run-spec-and-mocha-tests
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Europe/Helsinki"
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@4.0
with:
lein: 2.9.1
- name: Build
run: ./bin/cibuild.sh create-uberjar
- uses: actions/cache@v2
id: restore-build
with:
path: target
key: ${{ github.sha }}
build-and-deploy-container:
needs: [test-cypress, test-spec-and-mocha, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: restore-build
with:
path: target
key: ${{ github.sha }}
- name: Build and deploy Docker containers
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
export BASE_IMAGE="baseimage-fatjar-openjdk11:master"
./ci-tools/common/pull-image.sh
cp -v ./target/ataru.jar $DOCKER_BUILD_DIR/artifact/ataru-editori.jar
cp -vr ./oph-configuration $DOCKER_BUILD_DIR/config/
./ci-tools/github-build/build-fatjar.sh ataru-editori
./ci-tools/common/clean-docker-build-dir.sh
cp -v ./target/ataru.jar $DOCKER_BUILD_DIR/artifact/ataru-hakija.jar
cp -vr ./oph-configuration $DOCKER_BUILD_DIR/config/
./ci-tools/github-build/build-fatjar.sh ataru-hakija
./ci-tools/github-build/upload-image.sh ataru-editori
./ci-tools/github-build/upload-image.sh ataru-hakija