-
Notifications
You must be signed in to change notification settings - Fork 159
175 lines (173 loc) · 6.43 KB
/
ci-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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: ci-build
on:
push:
branches:
- main
tags-ignore:
- '*.*'
pull_request:
branches:
- main
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
updatewebsite:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 2
- name: Verify Changed files in docs
uses: tj-actions/verify-changed-files@9ed3155b72ba709881c967f75611fc5852f773b9 # v13.1
id: verify-changed-files
with:
files: |
docs
- name: update website
if: ${{ github.ref == 'refs/heads/main' && steps.verify-changed-files.outputs.files_changed == 'true'}}
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1
with:
workflow: github-pages
repo: jbangdev/jbang.dev
token: ${{ secrets.BREW_GITHUB_TOKEN }}
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
name: build-and-testing
steps:
- name: Rate limit info
run: 'curl -H "Accept: application/vnd.github+json" https://api.github.com/rate_limit'
- name: Setup tmate session
uses: mxschmitt/action-tmate@a283f9441d2d96eb62436dc46d7014f5d357ac22 # v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
with:
limit-access-to-actor: true
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # v3
- name: install-java8
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
java-version: 11
distribution: temurin
cache: gradle
- name: build-gradle
run: ./gradlew --no-daemon clean build installDist publish --build-cache --scan -s
- name: integration-test-non-windows
if: runner.os != 'Windows'
run: |
export PATH=`pwd`/build/install/jbang/bin:$PATH
cd itests
./test_suite.sh
./itests.sh
- name: add-to-path
run: echo "../build/install/jbang/bin" >> $env:GITHUB_PATH
- name: integration-test-windows
if: runner.os == 'Windows'
working-directory: itests
run: |
echo "::add-matcher::.github/karatewindows-matcher.json"
.\itests.cmd
echo "::remove-matcher owner=karate-windows::"
- name: codecoverage-report
run: |
./gradlew --no-daemon jacocoTestReport
- name: Upload Test Report
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: always() # always run even if the previous step fails
with:
name: junit-test-results
path: '**/build/test-results/test/TEST-*.xml'
retention-days: 1
- uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5
with:
#files: ./coverage1.xml,./coverage2.xml # optional
flags: ${{ runner.os }} # optional
name: ${{ runner.os }}-tests # optional
verbose: true # optional (default = false)
- name: build-choco-package
if: runner.os == 'Windows'
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4
with:
dotnet-version: '2.2.204' # SDK Version to use.
- name: build-choco
if: runner.os == 'Windows'
run: |
powershell
choco pack build/choco/jbang.nuspec
- name: Archive build results
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: always()
with:
name: ${{ runner.os }}-build-${{ github.sha }}
path: build
- name: Upload jbang.zip
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: always() && runner.os != 'Windows'
with:
name: jbang-${{ github.sha }}
path: build/install/jbang
testing:
needs: build
strategy:
## disable fail-fast so on variance failing don't fail the rest
#fail-fast: false
matrix:
os: [ubuntu-latest]
java: [8,11,17,21]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: ${{ runner.os }}-build-${{ github.sha }}
path: build
- name: smoke-test
run: |
java -version
chmod +x ./build/install/jbang/bin/jbang
./build/install/jbang/bin/jbang init --template=cli helloworld.java
./build/install/jbang/bin/jbang --verbose helloworld.java
rm helloworld.java
- name: smoke-quarkus-test
run: |
java -version
chmod +x ./build/install/jbang/bin/jbang
./build/install/jbang/bin/jbang init --template=qcli qcli.java
./build/install/jbang/bin/jbang --fresh --verbose qcli.java
rm qcli.java
- name: smoke-quarkus-diff-version-test
run: |
java -version
chmod +x ./build/install/jbang/bin/jbang
./build/install/jbang/bin/jbang init --template=qcli qcli.java
./build/install/jbang/bin/jbang --fresh --verbose --java 17 qcli.java
rm qcli.java
- name: integration-test-non-windows
## karate can't run on java 17 or higher due to missing nashorn
if: runner.os != 'Windows' && matrix.java < 17
run: |
export PATH=`pwd`/build/install/jbang/bin:$PATH
cd build/itests
chmod +x ./test_suite.sh
chmod +x ./itests.sh
./test_suite.sh
./itests.sh
- name: add-to-path
run: echo "../build/install/jbang/bin" >> $env:GITHUB_PATH
- name: integration-test-windows
if: runner.os == 'Windows' && matrix.java < 17
working-directory: itests
run: |
echo "::add-matcher::.github/karatewindows-matcher.json"
.\itests.cmd
echo "::remove-matcher owner=karate-windows::"