-
Notifications
You must be signed in to change notification settings - Fork 20
116 lines (104 loc) · 3.37 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
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- macos-13
- ubuntu-latest
test-java-version:
- 8
- 11
- 17
- 21
# macos-latest drops support for java 8 temurin. Run java 8 on macos-13. Run java 11, 17, 21 on macos-latest.
exclude:
- os: macos-latest
test-java-version: 8
- os: macos-13
test-java-version: 11
- os: macos-13
test-java-version: 17
- os: macos-13
test-java-version: 21
steps:
- uses: actions/checkout@v3
- id: setup-java-test
name: Set up Java ${{ matrix.test-java-version }} for tests
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.test-java-version }}
- id: setup-java
name: Set up Java for build
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: build
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
-PtestJavaVersion=${{ matrix.test-java-version }}
-Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }},${{ steps.setup-java.outputs.path }}
- name: generate
# Skip running on macos-latest which doesn't have docker
if: matrix.os == 'ubuntu-latest'
uses: gradle/gradle-build-action@v2
with:
arguments: |
generateSemanticConventions --console=plain
# Run spotless after generate to format generated code
- name: spotless
uses: gradle/gradle-build-action@v2
with:
arguments: |
spotlessApply
- name: Check for diff
run: |
# need to "git add" in case any generated files did not already exist
# select files from both /semconv and /semconv-incubating
git add semconv**
if git diff --cached --quiet
then
echo "No diff detected."
else
echo "Diff detected - did you run './gradlew generateSemanticConventions spotlessApply'?"
echo $(git diff --cached --name-only)
echo $(git diff --cached)
exit 1
fi
markdown-link-check:
# release branches are excluded to avoid unnecessary maintenance
if: ${{ !startsWith(github.ref_name, 'release/') }}
uses: ./.github/workflows/reusable-markdown-link-check.yml
misspell-check:
# release branches are excluded to avoid unnecessary maintenance
if: ${{ !startsWith(github.ref_name, 'release/') }}
uses: ./.github/workflows/reusable-misspell-check.yml
required-status-check:
# markdown-link-check is not required so pull requests are not blocked if external links break
# misspell-check is not required so pull requests are not blocked if the misspell dictionary is
# updated
needs:
- build
runs-on: ubuntu-latest
if: always()
steps:
- if: |
needs.build.result != 'success'
run: exit 1