-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
146 lines (133 loc) · 4.63 KB
/
Copy pathlinux.yaml
File metadata and controls
146 lines (133 loc) · 4.63 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
name: Linux tests
on:
push:
branches:
- master
- '[5-9]+.[0-9]+.x'
pull_request:
branches:
- master
- '[5-9]+.[0-9]+.x'
jobs:
setup:
name: Detect source changes
runs-on: ubuntu-latest
outputs:
source-changed: ${{ steps.check.outputs.source-changed }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- id: check
shell: bash
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.sha }}
run: |
if [[ "$BASE_SHA" == "0000000000000000000000000000000000000000" ]] || [[ -z "$BASE_SHA" ]]; then
BASE_SHA=$(git rev-parse HEAD~1 2>/dev/null || echo "")
fi
if [[ -n "$BASE_SHA" ]]; then
CHANGED=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" 2>/dev/null || git diff --name-only HEAD~1 HEAD)
else
CHANGED=$(git diff --name-only HEAD~1 HEAD)
fi
if echo "$CHANGED" | grep -qE '^(modules/|pom\.xml|\.mvn/)'; then
echo "source-changed=true" >> "$GITHUB_OUTPUT"
else
echo "source-changed=false" >> "$GITHUB_OUTPUT"
fi
build:
name: 'Build: JDK ${{ matrix.java }} (${{ matrix.os }})'
runs-on: ${{ matrix.os }}
needs: setup
if: needs.setup.outputs.source-changed == 'true'
strategy:
matrix:
java: [11, 17]
os: [ubuntu-latest]
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: gradle
- uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('modules/openapi-generator-gradle-plugin/pom.xml') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: gradle/actions/setup-gradle@v6
with:
cache-disabled: true
gradle-version: '8.14.3'
- name: Setup Maven
uses: s4u/setup-maven-action@v1.20.0
with:
java-version: ${{ matrix.java }}
maven-version: 3.8.8
- name: Build with Maven
shell: bash
run: ./mvnw clean -nsu -B --quiet -Dorg.slf4j.simpleLogger.defaultLogLevel=error --no-transfer-progress install --file pom.xml
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: Upload Maven build artifact
uses: actions/upload-artifact@v7
if: matrix.java == '11' && matrix.os == 'ubuntu-latest'
with:
name: artifact
path: modules/openapi-generator-cli/target/openapi-generator-cli.jar
- name: Test Gradle plugin usage
shell: bash
run: gradle --project-dir modules/openapi-generator-gradle-plugin/samples/local-spec buildGoSdk --stacktrace
- name: Test Maven plugin integration
if: matrix.java == '11'
shell: bash
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
run: |
cd modules/openapi-generator-maven-plugin
mvn clean verify -Pintegration
verify:
name: Verify outputs on ${{ matrix.os }}
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Setup Maven
uses: s4u/setup-maven-action@v1.20.0
with:
java-version: 11
maven-version: 3.8.8
cache: gradle
- name: Download build artifact
uses: actions/download-artifact@v8
with:
name: artifact
- name: Run Ensures Script
shell: bash
run: |
git config --global core.fileMode false
git config --global core.safecrlf false
git config --global core.autocrlf true
./mvnw clean package -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
# test with java (jersey2) client generation only as ensure-up-to-date script is run in another job instead
./bin/generate-samples.sh ./bin/configs/java-jersey2-8.yaml
# test debugSupportingFiles
./bin/generate-samples.sh ./bin/configs/go-petstore.yaml -- --global-property debugSupportingFiles