-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (136 loc) · 5.28 KB
/
build.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
name: Build JVM probe
on:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.svg'
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.svg'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '17' ]
timeout-minutes: 10
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.java }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: gradle
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
echo "::set-output name=version::$VERSION"
echo "SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}" >> $GITHUB_ENV
- run: ./gradlew assembleUp --refresh-dependencies
- name: Docker IPs
run: docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
- name: Set SPP_PLATFORM_HOST
run: SPP_PLATFORM_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=spp-platform")) && echo "SPP_PLATFORM_HOST=$SPP_PLATFORM_HOST" >> $GITHUB_ENV
- name: Wait for platform
run: |
until $(curl --output /dev/null --silent --fail http://localhost:12800/health); do printf '.'; sleep 5; done
#todo: create health for TraceSegmentServiceClient.statusChanged()
- run: sleep 45s
- run: ./gradlew check -Dtest.profile=integration
- run: ./gradlew composeLogs
if: ${{ always() }}
- name: Upload docker logs artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: docker-logs_jdk${{ matrix.java }}
path: ./build/containers-logs
- name: Upload skywalking-api.log artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: skywalking-api_jdk${{ matrix.java }}.log
path: /tmp/spp-probe/logs/skywalking-api.log
draft:
needs: build
runs-on: ubuntu-20.04
timeout-minutes: 10
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
echo "::set-output name=version::$VERSION"
echo "SPP_RELEASE_VERSION=${VERSION/-SNAPSHOT/}" >> $GITHUB_ENV
- run: ./gradlew assemble -Dbuild.profile=release -PprobeVersion=$SPP_RELEASE_VERSION
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
| tr '\r\n' ' ' \
| jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' \
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
- name: Create release draft
id: createDraft
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.SPP_RELEASE_VERSION }}
release_name: v${{ env.SPP_RELEASE_VERSION }}
draft: true
- name: Upload spp-probe asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createDraft.outputs.upload_url }}
asset_path: ./boot/build/libs/spp-probe-${{ env.SPP_RELEASE_VERSION }}.jar
asset_name: spp-probe-${{ env.SPP_RELEASE_VERSION }}.jar
asset_content_type: application/java-archive
- name: Upload spp-probe-services asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createDraft.outputs.upload_url }}
asset_path: ./services/build/libs/spp-skywalking-services-${{ env.SPP_RELEASE_VERSION }}.jar
asset_name: spp-skywalking-services-${{ env.SPP_RELEASE_VERSION }}.jar
asset_content_type: application/java-archive
- name: Remove Old Snapshot Packages
uses: smartsquaregmbh/[email protected]
with:
keep: 0
version-pattern: "^\\d+\\.\\d+\\.\\d+-SNAPSHOT$"
names: |
plus.sourceplus.probe.probe-jvm
plus.sourceplus.probe.probe-jvm-services
- name: Publish New Snapshot Packages
run: ./gradlew publish -Dbuild.profile=release
env:
GH_PUBLISH_USERNAME: $GITHUB_ACTOR
GH_PUBLISH_TOKEN: ${{ secrets.GITHUB_TOKEN }}