generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 14
147 lines (146 loc) · 5.99 KB
/
graalvm-oci.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
name: Oracle Cloud CI
on:
push:
branches:
- master
- '[1-9]+.[0-9]+.x'
pull_request:
branches:
- master
- '[1-9]+.[0-9]+.x'
jobs:
start-runner:
name: Start self-hosted OracleCloud runners
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-runner.outputs.label }}
steps:
- name: Install OCI CLI
uses: micronaut-projects/github-actions/configure-oracle-cloud-cli@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
oci-user-ocid: ${{ secrets.OCI_USER_ID }}
oci-region: ${{ secrets.OCI_REGION }}
oci-tenancy-ocid: ${{ secrets.OCI_TENANT_ID }}
oci-private-key: ${{ secrets.OCI_PRIVATE_KEY }}
oci-private-key-passphrase: ${{ secrets.OCI_PASSPHRASE }}
oci-private-key-fingerprint: ${{ secrets.OCI_FINGERPRINT }}
- name: Start runner
uses: micronaut-projects/github-actions/start-oracle-cloud-runners@master
id: start-runner
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
oci-compartment-ocid: ${{ secrets.MONITORING_COMPARTMENT_OCID }}
oci-subnet-ocid: ${{ secrets.OCI_SUBNET }}
oci-av-domain: ${{ secrets.OCI_AV_DOMAIN }}
oci-image-ocid: ${{ secrets.OCI_RUNNER_IMAGE }}
runners-count: '1'
build:
if: github.repository != 'micronaut-projects/micronaut-project-template'
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.label }}
strategy:
matrix:
java: [ '17' ]
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: "Set up JAVA_HOME for Gradle"
uses: actions/[email protected]
with:
distribution: 'oracle'
java-version: '17'
- name: "Set up GRAALVM_HOME for Native Build Tools"
uses: graalvm/[email protected]
with:
distribution: 'graalvm-community'
java-version: ${{ matrix.java }}
components: 'native-image'
set-java-home: 'false'
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
- name: Build with Gradle
id: gradle
run: |
if ./gradlew tasks --no-daemon --all | grep -w "nativeTest"
then
./gradlew check nativeTest --continue --no-daemon
fi
env:
MICRONAUT_ENV_DEDUCTION: false
OCI_FINGERPRINT: ${{ secrets.OCI_FINGERPRINT }}
OCI_PRIVATE_KEY: ${{ secrets.OCI_PRIVATE_KEY }}
OCI_REGION: ${{ secrets.OCI_REGION }}
OCI_TENANT_ID: ${{ secrets.OCI_TENANT_ID }}
OCI_USER_ID: ${{ secrets.OCI_USER_ID }}
OCI_PASSPHRASE: ${{ secrets.OCI_PASSPHRASE }}
ATP_OCID: ${{ secrets.ATP_OCID }}
ATP_USER: ${{ secrets.ATP_USER }}
ATP_PASS: ${{ secrets.ATP_PASS }}
VAULT_OCID: ${{ secrets.VAULT_OCID }}
VAULT_SECRETS_COMPARTMENT_OCID: ${{ secrets.VAULT_SECRETS_COMPARTMENT_OCID }}
MONITORING_COMPARTMENT_OCID: ${{ secrets.MONITORING_COMPARTMENT_OCID }}
VAULT_SECRET_NAME: ${{ secrets.VAULT_SECRET_NAME }}
VAULT_SECRET_VALUE: ${{ secrets.VAULT_SECRET_VALUE }}
COMPARTMENT_OCID: ${{ secrets.VAULT_SECRETS_COMPARTMENT_OCID }}
TESTCONTAINERS_RYUK_DISABLED: true
GH_TOKEN_PUBLIC_REPOS_READONLY: ${{ secrets.GH_TOKEN_PUBLIC_REPOS_READONLY }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}"
- name: Add build scan URL as PR comment
uses: actions/github-script@v7
if: github.event_name == 'pull_request' && failure()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '❌ ${{ github.workflow }} ${{ matrix.java }} latest failed: ${{ steps.gradle.outputs.build-scan-url }}'
})
- name: Publish Test Report
if: always()
uses: mikepenz/action-junit-report@v5
with:
check_name: GraalVM CE CI / Test Report (Java ${{ matrix.java }})
report_paths: '**/build/test-results/test/TEST-*.xml'
check_retries: 'true'
- name: Optional tear down step
env:
K8S_VERSION: ${{ matrix.k8s }}
JAVA_VERSION: ${{ matrix.java }}
run: |
[ -f ./teardown.sh ] && ./teardown.sh || true
stop-runner:
name: Stop self-hosted OracleCloud runners
needs:
- start-runner
- build
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Install OCI CLI
uses: micronaut-projects/github-actions/configure-oracle-cloud-cli@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
oci-user-ocid: ${{ secrets.OCI_USER_ID }}
oci-region: ${{ secrets.OCI_REGION }}
oci-tenancy-ocid: ${{ secrets.OCI_TENANT_ID }}
oci-private-key: ${{ secrets.OCI_PRIVATE_KEY }}
oci-private-key-passphrase: ${{ secrets.OCI_PASSPHRASE }}
oci-private-key-fingerprint: ${{ secrets.OCI_FINGERPRINT }}
- name: Stop runners
uses: micronaut-projects/github-actions/stop-oracle-cloud-runners@master
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
oci-compartment-ocid: ${{ secrets.MONITORING_COMPARTMENT_OCID }}
oci-runner-label-tag-value: ${{ needs.start-runner.outputs.label }}