-
-
Notifications
You must be signed in to change notification settings - Fork 301
168 lines (159 loc) · 5.82 KB
/
cibuild.yml
File metadata and controls
168 lines (159 loc) · 5.82 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
name: 'CI Build'
on:
push:
branches-ignore:
- 'dependabot/**'
paths:
- '**'
- '!docs/**'
- '!.github/**'
- '.github/**/*ci*'
- '!CONTRIBUTING.md'
- '!DEV_README.md'
pull_request:
paths:
- '**'
- '!docs/**'
- '!.github/**'
- '.github/**/*ci*'
- '!CONTRIBUTING.md'
- '!DEV_README.md'
env:
LC_ALL: en_US.UTF-8
GRADLE_OPTS: >-
-Dorg.gradle.parallel=true
MAVEN_OPTS: >-
-Dhttp.keepAlive=false
-Dmaven.wagon.http.pool=false
-Dmaven.wagon.http.retryHandler.count=3
-Daether.connector.http.retryHandler.count=5
-Daether.connector.http.reuseConnections=false
-Daether.connector.http.connectionMaxTtl=25
-Daether.connector.connectTimeout=120000
BNDTOOLS_CORE_TEST_NOJUNITOSGI: true # This test is very flaky on CI
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
P2_SIGN: true
P2_SIGN_KEY: ${{ secrets.GPG_KEY_ID }}
P2_SIGN_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
P2_PUB_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
SONATYPE_BEARER: ${{ secrets.SONATYPE_BEARER }}
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: ${{ (github.repository != 'bndtools/bnd') || ((github.ref != 'refs/heads/master') && (github.ref != 'refs/heads/next')) || (github.event_name == 'pull_request') }}
matrix:
os:
- 'ubuntu-latest'
java:
- '21'
- '25'
runner:
- '{0}' # 'xvfb-run --auto-servernum {0}'
include:
- os: 'ubuntu-latest'
java: '17'
runner: '{0}' # 'xvfb-run --auto-servernum {0}'
canonical: ${{ (github.repository == 'bndtools/bnd') && ((github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/next')) && (github.event_name != 'pull_request') }}
fetch-depth: '0'
- os: 'windows-latest'
java: '17'
runner: '{0}'
name: Build JDK${{ matrix.java }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Git Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
with:
fetch-depth: ${{ matrix.fetch-depth }}
- name: Set up Java 8 + ${{ matrix.java }}
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
with:
distribution: 'temurin'
java-version: |
8
${{ matrix.java }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2
#- name: Cache cnf cache and ~/.bnd/urlcache/
# id: cache-cnf-cache
# uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
# env:
# cache-name: cache-cnf-cache
# with:
# path: |
# "${{ github.workspace }}/cnf/cache"
# ~/.bnd/urlcache/
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/cnf/**/*.bnd', '**/cnf/**/*.mvn', '**/cnf/**/*.maven', '**/cnf/ext/*.*') }}
- name: Build
id: build
run: |
${{ format(matrix.runner, './.github/scripts/ci-build.sh') }}
- name: Configure settings.xml for Publish
if: ${{ matrix.canonical }}
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
server-id: bndtools.jfrog.io
server-username: JFROG_USERNAME
server-password: JFROG_PASSWORD
- name: Publish
id: publish
if: ${{ matrix.canonical }}
run: |
./.github/scripts/ci-publish.sh
env:
CANONICAL: ${{ matrix.canonical }}
JFROG_USERNAME: ${{ secrets.JFROG_USERNAME }}
JFROG_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
- name: Upload Test Reports
if: ${{ always() && ((steps.build.outcome == 'success') || (steps.build.outcome == 'failure')) }}
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: Build_JDK${{ matrix.java }}_${{ matrix.os }}-test-reports
path: |
*/generated/test-reports/*/TEST-*.xml
maven/*/target/surefire-reports/TEST-*.xml
gradle-plugins/*/build/test-results/*/TEST-*.xml
gradle-plugins/build/reports/*
- name: Publish PR p2 repo
if: ${{ github.event_name }} == 'pull_request' && ${{ matrix.java }} == '17' && ${{ matrix.os }}== 'ubuntu'
run: |
ls -laR org.bndtools.p2/*
env | sort
PR=${{ github.event.pull_request.number }}
ARTIFACT_PATH="org.bndtools.p2/generated/org.bndtools.p2.jar"
if [ -f "$ARTIFACT_PATH" ] && [ "$PR" != "" ]; then
echo "artifact found - start upload check"
if curl --silent --head --fail "https://bndtools.jfrog.io/artifactory/p2/pr/${PR}" > /dev/null; then
echo "URL already existing - delete previous deployment"
curl -s -X DELETE \
-H "Authorization: Bearer ${{ secrets.JFROG_SNAPSHOT_TOKEN }}" \
"https://bndtools.jfrog.io/artifactory/p2/pr/${PR}"
fi
echo "upload p2 repo to https://bndtools.jfrog.io/artifactory/p2/pr/${PR}"
curl -s \
-H "Authorization: Bearer ${{ secrets.JFROG_SNAPSHOT_TOKEN }}" \
-H "X-Explode-Archive: true" \
-T "$ARTIFACT_PATH" \
"https://bndtools.jfrog.io/artifactory/p2/pr/${PR}/org.bndtools.p2.zip"
if [ $? -eq 0 ]; then
echo "upload successful"
else
echo "upload failed"
fi
else
echo "Artifact $ARTIFACT_PATH not found, skipping upload."
fi
env:
JFROG_SNAPSHOT_TOKEN: ${{ secrets.JFROG_SNAPSHOT_TOKEN }}