Skip to content

Commit

Permalink
Issue antlr#3783: Fix CI check builds for windows platform
Browse files Browse the repository at this point in the history
Signed-off-by: HS <hs@apotell.com>
  • Loading branch information
hs-apotell committed Jul 12, 2022
1 parent f6c29b6 commit 8b6acd0
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/scripts-windows/run-tests-cpp.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set ChocolateyInstall=C:\tools\chocolatey
C:\ProgramData\chocolatey\bin\cinst.exe visualstudio2022-workload-vctools -y
REM set ChocolateyInstall=C:\tools\chocolatey
REM C:\ProgramData\chocolatey\bin\cinst.exe visualstudio2022-workload-vctools -y

cd runtime-testsuite
mvn -Dtest=cpp.** test
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts-windows/run-tests-python2.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd runtime-testsuite
mvn -Dantlr-python2-exec="C:\Python27\python.exe" -Dtest=python2.** test
mvn -Dantlr-python2-exec="%PYTHON_HOME%\python.exe" -Dtest=python2.** test
cd ..
2 changes: 1 addition & 1 deletion .github/scripts-windows/run-tests-python3.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd runtime-testsuite
mvn -Dantlr-python3-exec="C:\Python310\python.exe" -Dtest=python3.** test
mvn -Dantlr-python3-exec="%PYTHON_HOME%\python.exe" -Dtest=python3.** test
cd ..
117 changes: 79 additions & 38 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,115 @@ name: Windows

on:
push:
branches: [ dev ]
branches: [ dev, ci ]
pull_request:
branches: [ dev ]
branches: [ dev, ci ]

jobs:
build:
runs-on: [self-hosted, windows, x64]
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
TARGET: [java, python2, python3, javascript, csharp, dart, go, php]
TARGET: [
cpp,
csharp,
dart,
go,
java,
javascript,
python2,
python3,
php,
]

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11

- name: Set up Maven
uses: stCarolas/setup-maven@v4
uses: stCarolas/setup-maven@v4.4
with:
maven-version: 3.5.4
# fails due to permissions, use global install
# - name: Set up Python 2
# if: matrix.TARGET == 'python2'
# uses: actions/setup-python@v2
# with:
# python-version: '2.x'
# architecture: 'x64'
# fails due to permissions, use global install
# - name: Set up Python 3
# if: matrix.TARGET == 'python3'
# uses: actions/setup-python@v2
# with:
# python-version: '3.x'
# architecture: 'x64'

- name: Add msbuild to PATH
if: matrix.TARGET == 'cpp'
uses: microsoft/setup-msbuild@v1.1

- name: Set up Python 2
if: matrix.TARGET == 'python2'
uses: actions/setup-python@v4
with:
python-version: '2.x'
architecture: 'x64'

- name: Set up Python 3
if: matrix.TARGET == 'python3'
uses: actions/setup-python@v4
with:
python-version: '3.x'
architecture: 'x64'

- name: Set up Node 14
if: matrix.TARGET == 'javascript'
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '14'

- name: Setup Dotnet
if: matrix.TARGET == 'csharp'
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
# fails due to os (Linux only), use global install
# - name: Setup Dart 2.12.1
# uses: dart-lang/setup-dart@v1
# with:
# sdk: 2.12.1

- name: Setup Dart 2.12.1
if: matrix.TARGET == 'dart'
uses: dart-lang/setup-dart@v1.3
with:
sdk: 2.12.1

- name: Setup Go 1.13.1
if: matrix.TARGET == 'go'
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '^1.13.1'
# requires manually setting up pwsh
# fails due to incorrect script (missing printf)
# - name: Setup PHP 8.2
# if: matrix.TARGET == 'php'
# uses: shivammathur/setup-php@v2
# with:
# php-version: '8.2'
# extensions: mbstring
# tools: composer

- name: Setup PHP 8.2
if: matrix.TARGET == 'php'
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring
tools: composer

- name: Build tool with Maven
run: mvn install -DskipTests=true -Darguments="-Dmaven.javadoc.skip=true" -B -V

- name: Test with Maven
run: .github/scripts-windows/run-tests-${{ matrix.TARGET }}.cmd
run: |
gci env:* | sort-object name
.github/scripts-windows/run-tests-${{ matrix.TARGET }}.cmd
env:
TARGET: ${{ matrix.TARGET }}
PYTHON_HOME: ${{ env.pythonLocation }}
CMAKE_GENERATOR: Ninja

- name: Prepare artifacts
if: always()
run: |
cd ${{ github.workspace }}\..
tar czfp C:\antlr-${{ matrix.TARGET }}.tgz ${{ github.workspace }}
- name: Archive artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: antlr4
path: C:\antlr-${{ matrix.TARGET }}.tgz

0 comments on commit 8b6acd0

Please sign in to comment.