-
Notifications
You must be signed in to change notification settings - Fork 428
207 lines (189 loc) · 7.68 KB
/
go-platform.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
name: "Go Platform compatibility"
on:
push:
branches: [ "develop", "plc4go" ]
paths:
- code-generation/**
- protocols/**
- plc4go**
pull_request:
paths:
- code-generation/**
- protocols/**
- plc4go**
workflow_dispatch:
inputs:
forceUpdates:
description: "Forces a snapshot update"
required: false
default: 'false'
highLogPrecision:
description: "sets the logs to nano resolution"
required: false
default: 'false'
passLoggerToModel:
description: "passes the logger to the model"
required: false
default: 'false'
receiveTimeout:
description: "sets the receive timeout to milliseconds"
required: false
default: '600000'
traceTransactionManagerWorkers:
description: "sets tracing for transaction manager workers"
required: false
default: 'false'
traceTransactionManagerTransactions:
description: "sets tracing for transaction manager transactions"
required: false
default: 'false'
traceDefaultMessageCodecWorker:
description: "sets tracing for the default message codec worker"
required: false
default: 'false'
traceExecutorWorkers:
description: "sets tracing for executor workers"
required: false
default: 'false'
traceTestTransportInstance:
description: "sets tracing for test transport instance"
required: false
default: 'false'
env:
PLC4X_TEST_HIGH_TEST_LOG_PRECISION: ${{ github.event.inputs.highLogPrecision }}
PLC4X_TEST_PASS_LOGGER_TO_MODEL: ${{ github.event.inputs.passLoggerToModel }}
PLC4X_TEST_RECEIVE_TIMEOUT_MS: ${{ github.event.inputs.receiveTimeout }}
PLC4X_TEST_TRACE_TRANSACTION_MANAGER_WORKERS: ${{ github.event.inputs.traceTransactionManagerWorkers }}
PLC4X_TEST_TRACE_TRANSACTION_MANAGER_TRANSACTIONS: ${{ github.event.inputs.traceTransactionManagerTransactions }}
PLC4X_TEST_TRACE_DEFAULT_MESSAGE_CODEC_WORKER: ${{ github.event.inputs.traceDefaultMessageCodecWorker }}
PLC4X_TEST_TRACE_EXECUTOR_WORKERS: ${{ github.event.inputs.traceExecutorWorkers }}
PLC4X_TEST_TEST_TRANSPORT_INSTANCE: ${{ github.event.inputs.traceTestTransportInstance }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
jobs:
test:
strategy:
matrix:
# 8 not anymore supported for building
java: [ 17 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Install libpcap for Linux
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libpcap-dev
- name: Install libpcap for macos
if: matrix.os == 'macos-latest'
run: brew install libpcap
- name: Install libpcap for windows
if: matrix.os == 'windows-latest'
run: choco install -y nmap
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-package: jdk
java-version: ${{ matrix.java }}
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set Platform options
id: platform_opts
uses: actions/[email protected]
env:
OS: ${{ matrix.os }}
with:
script: |
const { OS } = process.env
if (OS.includes("windows")) {
core.setOutput('platform_opts', ``)
} else if (OS.includes("macos")) {
core.setOutput('platform_opts', `-Djna.library.path="$(find /usr/local/Cellar/libpcap/ -name lib)"`)
} else if (OS.includes("ubuntu")) {
core.setOutput('platform_opts', ``)
} else {
core.setOutput('platform_opts', ``)
}
- name: Calculate platform suffix
id: platform_suffix
uses: actions/[email protected]
env:
OS: ${{ matrix.os }}
with:
script: |
const { OS } = process.env
if (OS.includes("windows")) {
core.setOutput('platform_suffix', `.cmd`)
} else {
core.setOutput('platform_suffix', ``)
}
- name: Set extra options
id: extra_options
uses: actions/[email protected]
env:
FORCE_UPDATE: ${{ github.event.inputs.forceUpdates }}
with:
script: |
const { FORCE_UPDATE } = process.env
if (FORCE_UPDATE.includes("true")) {
core.setOutput('extra_options', `-U`)
} else {
core.setOutput('extra_options', ``)
}
# - name: Initialize CodeQL
# uses: github/codeql-action/init@v3
# with:
# languages: go
- name: Check LongPathsEnabled on Windows
if: matrix.os == 'windows-latest'
run: |
(Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
# Note: due to github has no concept of recovering from a fail even if we have our fallback below we append a second un-parallel run behind this to be sure that it works with all checks. Only if that fails too we are ok with a "red" (which should be yellow) cross indicating a problem
- name: Run mvnw
run: |
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-go,enable-all-checks,update-generated-code' -pl :plc4go -am ${{ steps.platform_opts.outputs.platform_opts }} install
- name: Upload Test Report (first failure)
uses: actions/upload-artifact@v4
if: failure()
with:
name: "golang-test-report-first-failure-${{ matrix.os }}"
path: |
**/surefire-reports/go-junit-report.xml
**/reports/test-out-verbose.log
- name: Run mvnv without BacNet regression tests
if: ${{ failure() }}
run: ./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} ${{ steps.extra_options.outputs.extra_options }} -B -P'with-go,skip-bacnet-regression-test,update-generated-code' -pl :plc4go -am ${{ steps.platform_opts.outputs.platform_opts }} install
- name: Upload Test Report
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: "golang-test-report-${{ matrix.os }}"
path: |
**/surefire-reports/go-junit-report.xml
**/reports/test-out-verbose.log
# - name: Perform CodeQL Analysis
# uses: github/codeql-action/analyze@v3