name: build on: push: pull_request: jobs: build: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - { name: linux-gcc, os: ubuntu-latest, cc: gcc, cxx: g++ } - { name: linux-clang, os: ubuntu-latest, cc: clang, cxx: clang++ } - { name: windows-msvc, os: windows-latest } - { name: windows-mingw, os: windows-latest, generator: MinGW Makefiles, cc: gcc, cxx: g++ } - { name: macos-clang, os: macos-latest } steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin java-version: '17' - name: Configure shell: bash run: | args=(-B build -DCMAKE_BUILD_TYPE=Release -DANTLRLAB_DOWNLOAD_JAR=ON) if [ -n "${{ matrix.generator }}" ]; then args+=(-G "${{ matrix.generator }}"); fi if [ -n "${{ matrix.cc }}" ]; then args+=(-DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }}); fi cmake "${args[@]}" - name: Build run: cmake --build build --config Release --parallel - name: Self-test and examples shell: bash run: | BIN=$(find build -type f \( -name antlrlab -o -name antlrlab.exe \) -not -path '*/CMakeFiles/*' | head -n 1) echo "using $BIN" "$BIN" --version "$BIN" --selftest "$BIN" examples/combined/Expr.g4 -t "1 + 2" --no-color "$BIN" -g examples/split/CalcLexer.g4 -g examples/split/CalcParser.g4 -i examples/split/input.txt -q --no-color "$BIN" examples/json/JSON.g4 examples/json/example.json -q --no-color # a syntax error must give exit status 1 set +e "$BIN" examples/combined/Expr.g4 examples/combined/input_bad.txt -q --no-color test $? -eq 1