-
Notifications
You must be signed in to change notification settings - Fork 6
127 lines (104 loc) · 3.21 KB
/
hosted.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
name: antlr5
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [ master, dev, hostedci ]
pull_request:
branches: [ master, dev ]
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [
macos-11,
ubuntu-20.04,
windows-2022
]
target: [
tool,
java,
kotlin,
]
steps:
# Check out the code before setting the environment since some
# of the actions actually parse the files to figure out the
# dependencies, for instance, the setup-java actually parses
# **/pom.xml files to decide what to cache.
- name: Check out code
uses: actions/checkout@v3
- name: Install dependencies (Ubuntu)
if: startswith(matrix.os, 'ubuntu')
run: |
sudo apt-get update -qq
sudo apt install -y ninja-build
- name: Install dependencies (MacOS)
if: startswith(matrix.os, 'macos')
run: brew install ninja
- name: Set up JDK 17
id: setup-java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
cache: 'maven'
- name: Set up Maven
if: steps.setup-java.outputs.cache-hit != 'true'
uses: stCarolas/[email protected]
with:
maven-version: 3.9.4
- name: Build ANTLR modules without testing
run: mvn install -DskipTests=true -Darguments="-Dmaven.javadoc.skip=true" -B -V
- name: Unit test core module
if: matrix.target != 'tool'
run: |
cd runtime/Core
mvn test
- id: capitalize
name: Capitalize target module name
if: matrix.target != 'tool'
uses: ASzc/change-string-case-action@v6
with:
string: ${{ matrix.target }}
- name: Unit test target module
if: matrix.target != 'tool'
run: |
cd runtime/${{ steps.capitalize.outputs.capitalized }}
mvn test
- name: Test tool
if: matrix.target == 'tool'
run: |
cd tool-testsuite
mvn test
- name: End-to-end test runtime (Windows)
if: startsWith(matrix.os, 'windows') && (matrix.target != 'tool')
run: |
gci env:* | sort-object name
cd runtime-testsuite
mvn -X '-Dtest=${{ matrix.target }}.**' test
env:
CMAKE_GENERATOR: Ninja
- name: End-to-end test runtime (non-Windows)
if: (startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')) && (matrix.target != 'tool')
run: |
env
cd runtime-testsuite
mvn -X '-Dtest=${{ matrix.target }}.**' test
- name: Prepare artifacts
if: always()
run: |
cd ${{ github.workspace }}/..
tar czfp antlr_${{ matrix.os }}_${{ matrix.target }}.tgz --exclude='.git' antlr5
mv antlr_${{ matrix.os }}_${{ matrix.target }}.tgz ${{ github.workspace }}/.
- name: Archive artifacts
if: always()
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: antlr_${{ matrix.os }}_${{ matrix.target }}
path: antlr_${{ matrix.os }}_${{ matrix.target }}.tgz