Skip to content

Commit 21219be

Browse files
authored
Restore custom workflows (#477)
* Restore custom workflows * Restore custom workflows * Restore custom workflows
1 parent 1c0a1d7 commit 21219be

File tree

3 files changed

+156
-40
lines changed

3 files changed

+156
-40
lines changed

.github/workflows/.rsync-filter

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- graalvm.yml
2+
- gradle.yml

.github/workflows/graalvm.yml

Lines changed: 84 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,111 @@ on:
1414
- master
1515
- '[1-9]+.[0-9]+.x'
1616
jobs:
17+
start-runner:
18+
name: Start self-hosted OracleCloud runners
19+
runs-on: ubuntu-latest
20+
outputs:
21+
label: ${{ steps.start-runner.outputs.label }}
22+
steps:
23+
- name: Install OCI CLI
24+
uses: micronaut-projects/github-actions/configure-oracle-cloud-cli@master
25+
with:
26+
github-token: ${{ secrets.GITHUB_TOKEN }}
27+
oci-user-ocid: ${{ secrets.OCI_USER }}
28+
oci-region: ${{ secrets.OCI_REGION }}
29+
oci-tenancy-ocid: ${{ secrets.OCI_TENANCY }}
30+
oci-private-key: ${{ secrets.OCI_KEY_FILE }}
31+
oci-private-key-passphrase: ${{ secrets.OCI_PASSPHRASE }}
32+
oci-private-key-fingerprint: ${{ secrets.OCI_FINGERPRINT }}
33+
- name: Start runner
34+
uses: micronaut-projects/github-actions/start-oracle-cloud-runners@master
35+
id: start-runner
36+
with:
37+
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
38+
oci-compartment-ocid: ${{ secrets.OCI_COMPARTMENT }}
39+
oci-subnet-ocid: ${{ secrets.OCI_SUBNET }}
40+
oci-av-domain: ${{ secrets.OCI_AV_DOMAIN }}
41+
oci-image-ocid: ${{ secrets.OCI_RUNNER_IMAGE }}
42+
runners-count: '1'
1743
build:
1844
if: github.repository != 'micronaut-projects/micronaut-project-template'
19-
runs-on: ubuntu-latest
45+
needs: start-runner
46+
runs-on: ${{ needs.start-runner.outputs.label }}
2047
strategy:
2148
matrix:
22-
java: ['11', '17']
49+
java: [ '11' ]
50+
k8s: [ '1.21' ]
2351
steps:
24-
# https://github.com/actions/virtual-environments/issues/709
25-
- name: Free disk space
26-
run: |
27-
sudo rm -rf "/usr/local/share/boost"
28-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
29-
sudo apt-get clean
30-
df -h
52+
- uses: AutoModality/[email protected]
3153
- uses: actions/checkout@v3
3254
- uses: actions/cache@v3
3355
with:
3456
path: ~/.gradle/caches
3557
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
3658
restore-keys: |
3759
${{ runner.os }}-gradle-
38-
- name: Setup GraalVM CE
39-
uses: graalvm/setup-graalvm@v1
60+
- name: Set up JDK
61+
uses: actions/setup-java@v2
4062
with:
41-
version: '22.0.0.2'
63+
distribution: 'adopt'
4264
java-version: ${{ matrix.java }}
43-
components: 'native-image'
65+
- name: Setup step
66+
env:
67+
K8S_VERSION: ${{ matrix.k8s }}
68+
JAVA_VERSION: ${{ matrix.java }}
69+
EXAMPLE_SERVICE_RUNTIME: 'native'
70+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
71+
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
72+
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
73+
run: |
74+
[ -f ./setup.sh ] && ./setup.sh || true
4475
- name: Build with Gradle
4576
run: |
46-
if ./gradlew tasks --no-daemon --all | grep -w "testNativeImage"
47-
then
48-
./gradlew check testNativeImage --continue --no-daemon
49-
else
50-
./gradlew check --continue --no-daemon
51-
fi
77+
set -e
78+
for EXAMPLE in $(ls ./examples); do
79+
./gradlew ${EXAMPLE}:test --continue --no-daemon --no-build-cache
80+
done
81+
env:
82+
TESTCONTAINERS_RYUK_DISABLED: true
83+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
84+
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
85+
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
86+
PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}"
87+
- name: Optional tear down step
5288
env:
53-
TESTCONTAINERS_RYUK_DISABLED: true
54-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
55-
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
56-
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
57-
PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}"
89+
K8S_VERSION: ${{ matrix.k8s }}
90+
JAVA_VERSION: ${{ matrix.java }}
91+
run: |
92+
[ -f ./teardown.sh ] && ./teardown.sh || true
5893
- name: Publish Test Report
5994
if: always()
6095
uses: mikepenz/[email protected]
6196
with:
6297
check_name: GraalVM CE CI / Test Report (Java ${{ matrix.java }})
6398
report_paths: '**/build/test-results/test/TEST-*.xml'
6499
check_retries: 'true'
100+
stop-runner:
101+
name: Stop self-hosted OracleCloud runners
102+
needs:
103+
- start-runner
104+
- build
105+
runs-on: ubuntu-latest
106+
if: ${{ always() }}
107+
steps:
108+
- name: Install OCI CLI
109+
uses: micronaut-projects/github-actions/configure-oracle-cloud-cli@master
110+
with:
111+
github-token: ${{ secrets.GITHUB_TOKEN }}
112+
oci-user-ocid: ${{ secrets.OCI_USER }}
113+
oci-region: ${{ secrets.OCI_REGION }}
114+
oci-tenancy-ocid: ${{ secrets.OCI_TENANCY }}
115+
oci-private-key: ${{ secrets.OCI_KEY_FILE }}
116+
oci-private-key-passphrase: ${{ secrets.OCI_PASSPHRASE }}
117+
oci-private-key-fingerprint: ${{ secrets.OCI_FINGERPRINT }}
118+
- name: Stop runners
119+
uses: micronaut-projects/github-actions/stop-oracle-cloud-runners@master
120+
with:
121+
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
122+
oci-compartment-ocid: ${{ secrets.OCI_COMPARTMENT }}
123+
oci-runner-label-tag-value: ${{ needs.start-runner.outputs.label }}
124+

.github/workflows/gradle.yml

Lines changed: 70 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,42 @@ on:
1414
- master
1515
- '[1-9]+.[0-9]+.x'
1616
jobs:
17+
start-runner:
18+
name: Start self-hosted OracleCloud runners
19+
runs-on: ubuntu-latest
20+
outputs:
21+
label: ${{ steps.start-runner.outputs.label }}
22+
steps:
23+
- name: Install OCI CLI
24+
uses: micronaut-projects/github-actions/configure-oracle-cloud-cli@master
25+
with:
26+
github-token: ${{ secrets.GITHUB_TOKEN }}
27+
oci-user-ocid: ${{ secrets.OCI_USER }}
28+
oci-region: ${{ secrets.OCI_REGION }}
29+
oci-tenancy-ocid: ${{ secrets.OCI_TENANCY }}
30+
oci-private-key: ${{ secrets.OCI_KEY_FILE }}
31+
oci-private-key-passphrase: ${{ secrets.OCI_PASSPHRASE }}
32+
oci-private-key-fingerprint: ${{ secrets.OCI_FINGERPRINT }}
33+
- name: Start runners
34+
uses: micronaut-projects/github-actions/start-oracle-cloud-runners@master
35+
id: start-runner
36+
with:
37+
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
38+
oci-compartment-ocid: ${{ secrets.OCI_COMPARTMENT }}
39+
oci-subnet-ocid: ${{ secrets.OCI_SUBNET }}
40+
oci-av-domain: ${{ secrets.OCI_AV_DOMAIN }}
41+
oci-image-ocid: ${{ secrets.OCI_RUNNER_IMAGE }}
42+
runners-count: '3'
1743
build:
1844
if: github.repository != 'micronaut-projects/micronaut-project-template'
19-
runs-on: ubuntu-latest
45+
needs: start-runner
46+
runs-on: ${{ needs.start-runner.outputs.label }}
2047
strategy:
2148
matrix:
2249
java: ['8', '11', '17']
50+
k8s: ['1.18', '1.19', '1.20', '1.21']
2351
steps:
24-
# https://github.com/actions/virtual-environments/issues/709
25-
- name: Free disk space
26-
run: |
27-
sudo rm -rf "/usr/local/share/boost"
28-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
29-
sudo apt-get clean
30-
df -h
52+
- uses: AutoModality/[email protected]
3153
- uses: actions/checkout@v3
3254
- uses: actions/cache@v3
3355
with:
@@ -36,12 +58,14 @@ jobs:
3658
restore-keys: |
3759
${{ runner.os }}-gradle-
3860
- name: Set up JDK
39-
uses: actions/setup-java@v3
61+
uses: actions/setup-java@v2
4062
with:
4163
distribution: 'adopt'
4264
java-version: ${{ matrix.java }}
4365
- name: Optional setup step
4466
env:
67+
K8S_VERSION: ${{ matrix.k8s }}
68+
JAVA_VERSION: ${{ matrix.java }}
4569
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
4670
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
4771
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
@@ -53,11 +77,17 @@ jobs:
5377
if [ ${{ matrix.java }} == 16 ]; then export GRADLE_OPTS="-Dorg.gradle.jvmargs=--illegal-access=permit"; fi
5478
./gradlew dependencyUpdates check --no-daemon --parallel --continue
5579
env:
56-
TESTCONTAINERS_RYUK_DISABLED: true
57-
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
58-
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
59-
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
60-
PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}"
80+
TESTCONTAINERS_RYUK_DISABLED: true
81+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
82+
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
83+
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
84+
PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}"
85+
- name: Optional tear down step
86+
env:
87+
K8S_VERSION: ${{ matrix.k8s }}
88+
JAVA_VERSION: ${{ matrix.java }}
89+
run: |
90+
[ -f ./teardown.sh ] && ./teardown.sh || true
6191
- name: Publish Test Report
6292
if: always()
6393
uses: mikepenz/[email protected]
@@ -66,7 +96,7 @@ jobs:
6696
report_paths: '**/build/test-results/test/TEST-*.xml'
6797
check_retries: 'true'
6898
- name: Publish to Sonatype Snapshots
69-
if: success() && github.event_name == 'push' && matrix.java == '8'
99+
if: success() && github.event_name == 'push' && matrix.java == '8' && matrix.k8s == '1.19'
70100
env:
71101
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
72102
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
@@ -82,10 +112,34 @@ jobs:
82112
if_true: "micronaut-projects/micronaut-docs"
83113
if_false: ${{ github.repository }}
84114
- name: Publish to Github Pages
85-
if: success() && github.event_name == 'push' && matrix.java == '8'
115+
if: success() && github.event_name == 'push' && matrix.java == '8' && matrix.k8s == '1.19'
86116
uses: micronaut-projects/github-pages-deploy-action@master
87117
env:
88118
TARGET_REPOSITORY: ${{ steps.docs_target.outputs.value }}
89119
GH_TOKEN: ${{ secrets.GH_TOKEN }}
90120
BRANCH: gh-pages
91121
FOLDER: build/docs
122+
stop-runner:
123+
name: Stop self-hosted OracleCloud runners
124+
needs:
125+
- start-runner
126+
- build
127+
runs-on: ubuntu-latest
128+
if: ${{ always() }}
129+
steps:
130+
- name: Install OCI CLI
131+
uses: micronaut-projects/github-actions/configure-oracle-cloud-cli@master
132+
with:
133+
github-token: ${{ secrets.GITHUB_TOKEN }}
134+
oci-user-ocid: ${{ secrets.OCI_USER }}
135+
oci-region: ${{ secrets.OCI_REGION }}
136+
oci-tenancy-ocid: ${{ secrets.OCI_TENANCY }}
137+
oci-private-key: ${{ secrets.OCI_KEY_FILE }}
138+
oci-private-key-passphrase: ${{ secrets.OCI_PASSPHRASE }}
139+
oci-private-key-fingerprint: ${{ secrets.OCI_FINGERPRINT }}
140+
- name: Stop runners
141+
uses: micronaut-projects/github-actions/stop-oracle-cloud-runners@master
142+
with:
143+
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
144+
oci-compartment-ocid: ${{ secrets.OCI_COMPARTMENT }}
145+
oci-runner-label-tag-value: ${{ needs.start-runner.outputs.label }}

0 commit comments

Comments
 (0)