-
Notifications
You must be signed in to change notification settings - Fork 9
211 lines (189 loc) · 11.4 KB
/
main.yml
File metadata and controls
211 lines (189 loc) · 11.4 KB
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
210
211
# GitHub action recipe
# preconditions:
# - Install Java
# > wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm
# > rpm -Uvh jdk-17_linux-x64_bin.rpm && rm jdk-17_linux-x64_bin.rpm
# - Install Chromium for the dependencies needed by playwright:
# - Install jRuby
# > curl -sSL https://get.rvm.io | bash
# > source "$HOME/.rvm/scripts/rvm"
# > rvm install ${JRUBY_VERSION}
# > rvm --default use ${JRUBY_VERSION}
# > gem install bundler
name: Panorama CI
on:
push:
schedule:
# * is a special character in YAML so you have to quote this string, runs each day to keep the free autonomous DB alive
- cron: '0 0 * * *'
jobs:
setup:
runs-on: self-hosted
steps:
- name: Remove orphanded DB containers older than 1 hour from previous runs
run: |
docker ps --filter "name=DB*" | grep "hours ago\|days ago|weeks ago" | awk '{print $1}' | xargs -r docker rm -f
# !!! Remember to adjust the "needed" jobs in awaits_tests if changing the test jobs here !!!
test_autonomous_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "autonomous", container: "PDB", max_parallel: 1 }, secrets: "inherit"}
test_11_2-ee: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "11.2.0.4-ee", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
test_12_1-ee: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "12.1.0.2-ee", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
test_12_2-ee_CDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "12.2.0.1-ee", container: "CDB", max_parallel: 4 }, secrets: "inherit"}
test_12_2-ee_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "12.2.0.1-ee", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
#test_18_3-ee_CDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "18.3.0.0-ee", container: "CDB", max_parallel: 4 }, secrets: "inherit"}
#test_18_3-ee_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "18.3.0.0-ee", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
test_18_4-xe_CDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "18.4.0.0-xe", container: "CDB", max_parallel: 4 }, secrets: "inherit"}
# test_18_4-xe_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "18.4.0.0-xe", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
#test_19_10-ee_CDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "19.10.0.0-ee", container: "CDB", max_parallel: 4 }, secrets: "inherit"}
test_19_10-ee_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "19.10.0.0-ee", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
test_19_10-se2_CDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "19.10.0.0-se2", container: "CDB", max_parallel: 4 }, secrets: "inherit"}
test_19_10-se2_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "19.10.0.0-se2", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
test_21_3-ee_CDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "21.3.0.0-ee", container: "CDB", max_parallel: 4 }, secrets: "inherit"}
test_21_3-ee_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "21.3.0.0-ee", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
test_21_3-se2_CDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "21.3.0.0-se2", container: "CDB", max_parallel: 4 }, secrets: "inherit"}
test_21_3-se2_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "21.3.0.0-se2", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
# test_23_4-free_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "21.4-free", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
test_23_5-free_CDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "23.5.0.24-free", container: "CDB", max_parallel: 4 }, secrets: "inherit"}
test_23_5-free_PDB: { uses: "rammpeter/panorama/.github/workflows/run_tests.yml@master", needs: [setup], with: { db_version: "23.5.0.24-free", container: "PDB", max_parallel: 4 }, secrets: "inherit"}
await_tests:
runs-on: ubuntu-latest
needs: [test_autonomous_PDB, test_11_2-ee, test_12_1-ee, test_12_2-ee_CDB, test_12_2-ee_PDB, test_18_4-xe_CDB, test_19_10-ee_PDB, test_19_10-se2_CDB, test_19_10-se2_PDB, test_21_3-ee_CDB, test_21_3-ee_PDB, test_21_3-se2_CDB, test_21_3-se2_PDB]
steps:
- name: Proceed
run: echo "Proceed with build if all tests passed"
build_docker:
runs-on: self-hosted
needs: await_tests
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get version numbers
run: |
echo "JRUBY_VERSION=`cat .ruby-version | cut -c 7-20`" >> $GITHUB_ENV
echo JRUBY_VERSION=$JRUBY_VERSION
PANORAMA_VERSION=`cat config/application.rb | grep "VERSION =" | cut -d " " -f5 | sed "s/'//g"`
echo "PANORAMA_VERSION=$PANORAMA_VERSION" >> $GITHUB_ENV
echo PANORAMA_VERSION=$PANORAMA_VERSION
- name: Build and local push Docker image
run: |
for FROM in `grep "^FROM" Dockerfile | grep -v scratch | awk '{print $2}' | tail -n1`; do
echo "Ensure using latest version of $FROM"
docker pull $FROM
done
docker build --build-arg JRUBY_VERSION=$JRUBY_VERSION -t ghcr.io/rammpeter/panorama:latest .
docker login -u rammpeter -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
docker push ghcr.io/rammpeter/panorama:latest
- name: Test Docker image
run: |
echo "Test docker image"
- name: Final push Docker image
run: |
# Check if release already exists
# Ensure that exit code != 0 does not stop the build
set +e
docker pull ghcr.io/rammpeter/panorama:$PANORAMA_VERSION
if [[ $? -eq 1 ]];then
echo "Image with release $PANORAMA_VERSION does not exist, deploying"
set -e
docker tag ghcr.io/rammpeter/panorama:latest ghcr.io/rammpeter/panorama:$PANORAMA_VERSION
docker push ghcr.io/rammpeter/panorama:$PANORAMA_VERSION
docker login -u rammpeter -p ${{ secrets.DOCKER_IO_API_KEY }} docker.io
docker tag ghcr.io/rammpeter/panorama:latest docker.io/rammpeter/panorama:$PANORAMA_VERSION
docker push docker.io/rammpeter/panorama:$PANORAMA_VERSION
docker tag ghcr.io/rammpeter/panorama:latest docker.io/rammpeter/panorama:latest
docker push docker.io/rammpeter/panorama:latest
else
echo "Image with release $PANORAMA_VERSION already exists, no deployment"
fi
build_jar:
runs-on: self-hosted
needs: await_tests
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get version numbers
run: |
echo "JRUBY_VERSION=`cat .ruby-version | cut -c 7-20`" >> $GITHUB_ENV
echo JRUBY_VERSION=$JRUBY_VERSION
PANORAMA_VERSION=`cat config/application.rb | grep "VERSION =" | cut -d " " -f5 | sed "s/'//g"`
echo "PANORAMA_VERSION=$PANORAMA_VERSION" >> $GITHUB_ENV
echo PANORAMA_VERSION=$PANORAMA_VERSION
- name: Build jar
run: |
source "$HOME/.rvm/scripts/rvm"
rvm use --default jruby-$JRUBY_VERSION
bundle config deployment 'true'
bundle install --jobs 4
# Jarbler should not be part of Panorama.jar, therefore installed separately
gem install jarbler
./build_jar.sh
- name: Archive Panorama.jar
uses: actions/upload-artifact@v4
with:
name: Panorama.jar
path: Panorama.jar
test_jar:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
java: ['11', '21']
runs-on: ${{ matrix.os }}
needs: build_jar
steps:
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: false # runs 'bundle install' and caches installed gems automatically
- name: Check out code
uses: actions/checkout@v2
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: Panorama.jar
- name: Test Panorama.jar
run: |
echo "Test Panorama.jar"
ruby test/test_panorama_jar.rb
deploy_jar:
runs-on: self-hosted
needs: test_jar
steps:
- name: Final deploy Panorama.jar
run: |
# Ensure that exit code != 0 does not stop the build
set +e
# Scan all releases for the version
curl -L -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/rammpeter/panorama/releases | grep tag_name | grep "$PANORAMA_VERSION"
if [[ $? -eq 1 ]];then
echo "Release with version $PANORAMA_VERSION does not exist, deploying"
set -e
# Create release
RES=`curl -L -X POST --silent \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/rammpeter/panorama/releases \
-d "{\"tag_name\":\"v$PANORAMA_VERSION\",\"target_commitish\":\"master\",\"name\":\"Release $PANORAMA_VERSION\",\"body\":\"Continous development\",\"draft\":false,\"prerelease\":false,\"generate_release_notes\":false}"`
RELEASE_ID=`echo $RES | jq ".id"`
if [[ "$RELEASE_ID" == "null" ]]; then
echo "Release creation failed! Response was:"
echo $RES
exit 1
fi
# Add asset to release
RES=`curl -L -X POST --silent \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @Panorama.jar \
"https://uploads.github.com/repos/rammpeter/panorama/releases/$RELEASE_ID/assets?name=Panorama.jar&label=Panorama.jar:%20Download%20and%20start%20with%20\"java%20-jar%20Panorama.jar\""`
URL=`echo $RES | jq ".url"`
if [[ "$URL" == "null" ]]; then
echo "Asset creation for release failed! Response was:"
echo $RES
exit 1
fi
else
echo "Release with version $PANORAMA_VERSION already exists, no deployment"
fi