generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
209 lines (183 loc) · 7.66 KB
/
prerelease.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Sets up the pre-release of a deploy for staging testing with the staging tag
name: Pre-release
on:
push:
tags:
- "staging"
run-name: Pre-release for commit ${{ github.sha }}
jobs:
Create_Pre-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
# Run and build using gradle
# Disable aggregateJavaDocs
- name: Run build
run: ./gradlew distZip testCodeCoverageReport javadoc
# Confirm the test code inside wres-external-services-tests zip compiles
- name: Compile external-services-tests
run: |
cd wres-external-services-tests
../gradlew installDist
cd build/install/wres-external-services-tests
./gradlew testClasses
# Create the system tests zip
- name: Create systests zip
run: |
cd systests
../gradlew distZip installDist
# Create the admin scripts zip
- name: Create admin scripts
run: |
cd scripts
../gradlew distZip
# Create the md5
- name: Creating md5checksum
run: |
md5sum build/distributions/wres-*.zip >> md5checksum.txt
md5sum wres-*/build/distributions/wres-*-*.zip >> md5checksum.txt
md5sum systests/build/distributions/systests-*.zip >> md5checksum.txt
md5sum scripts/build/distributions/wres-admin-scripts-*.zip >> md5checksum.txt
# Create the sha256
- name: Creating sha256checksum
run: |
sha256sum build/distributions/wres-*.zip >> sha256checksum.txt
sha256sum wres-*/build/distributions/wres-*-*.zip >> sha256checksum.txt
sha256sum systests/build/distributions/systests-*.zip >> sha256checksum.txt
sha256sum scripts/build/distributions/wres-admin-scripts-*.zip >> sha256checksum.txt
# Deletes drafts incase the staging tag was deleted to change it to a different commit
- name: Delete drafts
uses: hugo19941994/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Stores relevant artifacts for the pre-release
- name: Create pre-release
uses: softprops/action-gh-release@v2
with:
prerelease: true
files: |
md5checksum.txt
sha256checksum.txt
Release.txt
build/distributions/wres-*.zip
wres-*/build/distributions/wres-*-*.zip
systests/build/distributions/systests-*.zip
scripts/build/distributions/wres-admin-scripts-*.zip
# Label of the runner job
database-migration-check:
runs-on: ubuntu-latest
needs: Create_Pre-release
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: wres8
POSTGRES_USER: wres_user
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Install PostgreSQL client
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
# Create wres schema
- name: Query database
run: |
psql -h localhost -d wres8 -U wres_user -c 'create schema wres authorization wres_user;'
env:
# postgress password is required; alternatively, you can run:
# `PGPASSWORD=postgres_password psql ...`
PGPASSWORD: postgres
- name: Create directories for downloads
run: |
mkdir upcomingRelease
mkdir pastRelease
- name: Download latest release
uses: robinraju/release-downloader@v1
with:
latest: true
# Download the attached zipball (*.zip)
tarBall: true
zipBall: true
fileName: '*.zip'
out-file-path: 'pastRelease'
- name: Download staging to be release
uses: robinraju/release-downloader@v1
with:
tag: 'staging'
# Download the attached zipball (*.zip)
tarBall: true
zipBall: true
fileName: '*.zip'
out-file-path: 'upcomingRelease'
- name: Migrate database from latest release
run: |
cd pastRelease
ls | grep -P 'wres-\d{8}-.*' | xargs chmod 777
ls | grep -P 'wres-\d{8}-.*' | xargs unzip
echo $(ls | grep -P 'wres-\d{8}-.{7}((?!zip).)*$')
cd $(ls | grep -P 'wres-\d{8}-.{7}((?!zip).)*$')
cd bin
mkdir smalldata
cp ../../../systests/smalldata/1985043012_DRRC2FAKE1_forecast.xml smalldata
cp ../../../systests/smalldata/1985043013_DRRC2FAKE1_forecast.xml smalldata
cp ../../../systests/smalldata/1985043014_DRRC2FAKE1_forecast.xml smalldata
cp ../../../systests/smalldata/DRRC2QINE_FAKE_19850430.xml smalldata
JAVA_OPTS="-Dwres.useDatabase=true -Dwres.useSSL=false -Dwres.username=wres_user -Dwres.databaseHost=localhost -Dwres.databaseName=wres8 -Dwres.password=postgres" ./wres execute ../../../systests/scenario500/evaluation.yml
- name: Run upcoming release
run: |
cd upcomingRelease
ls | grep -P 'wres-\d{8}-.*' | xargs chmod 777
ls | grep -P 'wres-\d{8}-.*' | xargs unzip
echo $(ls | grep -P 'wres-\d{8}-.{7}((?!zip).)*$')
cd $(ls | grep -P 'wres-\d{8}-.{7}((?!zip).)*$')
cd bin
mkdir smalldata
cp ../../../systests/smalldata/1985043012_DRRC2FAKE1_forecast.xml smalldata
cp ../../../systests/smalldata/1985043013_DRRC2FAKE1_forecast.xml smalldata
cp ../../../systests/smalldata/1985043014_DRRC2FAKE1_forecast.xml smalldata
cp ../../../systests/smalldata/DRRC2QINE_FAKE_19850430.xml smalldata
JAVA_OPTS="-Dwres.useDatabase=true -Dwres.useSSL=false -Dwres.username=wres_user -Dwres.databaseHost=localhost -Dwres.databaseName=wres8 -Dwres.password=postgres" ./wres execute ../../../systests/scenario500/evaluation.yml
# drops table and re-create it to test migration from fresh new release
- name: Drops table to test fresh migration from upcoming
run: |
psql -h localhost -d wres8 -U wres_user -c 'drop schema wres CASCADE;'
psql -h localhost -d postgres -U wres_user -c 'drop database wres8;'
psql -h localhost -d postgres -U wres_user -c 'create database wres8 owner wres_user;'
psql -h localhost -d wres8 -U wres_user -c 'create schema wres authorization wres_user;'
env:
# postgress password is required; alternatively, you can run:
# `PGPASSWORD=postgres_password psql ...`
PGPASSWORD: postgres
- name: Fresh migration from upcoming release
run: |
cd upcomingRelease
cd $(ls | grep -P 'wres-\d{8}-.{7}((?!zip).)*$')
cd bin
JAVA_OPTS="-Dwres.useDatabase=true -Dwres.useSSL=false -Dwres.username=wres_user -Dwres.databaseHost=localhost -Dwres.databaseName=wres8 -Dwres.password=postgres" ./wres execute ../../../systests/scenario500/evaluation.yml