|
| 1 | +--- |
| 2 | +name: Test Parser |
| 3 | + |
| 4 | +on: workflow_dispatch |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + timeout-minutes: 10 |
| 13 | + steps: |
| 14 | + |
| 15 | + - name: Checkout Repository |
| 16 | + uses: actions/checkout@v2 |
| 17 | + |
| 18 | + - name: Cache Build |
| 19 | + id: cache |
| 20 | + uses: actions/cache@v2 |
| 21 | + with: |
| 22 | + path: build |
| 23 | + key: ${{ runner.os }}-client1 |
| 24 | + |
| 25 | + - name: Setup Ubuntu |
| 26 | + shell: bash |
| 27 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 28 | + run: | |
| 29 | + sudo apt update |
| 30 | + sudo apt install curl zip g++ make ninja-build antlr libantlr-dev \ |
| 31 | + libxml2-dev libxml2-utils libxslt1-dev \ |
| 32 | + libarchive-dev libssl-dev libcurl4-openssl-dev \ |
| 33 | + cpio man file dpkg-dev |
| 34 | + curl -L http://www.sdml.cs.kent.edu/build/srcML-1.0.0-Boost.tar.gz | \ |
| 35 | + sudo tar xz -C /usr/local/include |
| 36 | +
|
| 37 | + - name: Setup macOS |
| 38 | + shell: bash |
| 39 | + if: ${{ matrix.os == 'macos-latest' }} |
| 40 | + run: | |
| 41 | + brew install ninja antlr2 |
| 42 | + curl -L http://www.sdml.cs.kent.edu/build/srcML-1.0.0-Boost.tar.gz | \ |
| 43 | + sudo tar xz -C /usr/local/include |
| 44 | +
|
| 45 | + - name: Setup Windows |
| 46 | + uses: microsoft/setup-msbuild@v1 |
| 47 | + if: ${{ matrix.os == 'windows-latest' }} |
| 48 | + |
| 49 | + - name: Create build directory |
| 50 | + shell: bash |
| 51 | + if: ${{ !steps.cache.outputs.cache-hit }} |
| 52 | + run: mkdir build |
| 53 | + |
| 54 | + - name: Build on Windows |
| 55 | + shell: bash |
| 56 | + if: ${{ matrix.os == 'windows-latest' }} |
| 57 | + working-directory: build |
| 58 | + run: | |
| 59 | + cmake .. |
| 60 | + cmake --build . --config Release --target install |
| 61 | +
|
| 62 | + - name: Build on Ubuntu/macOS |
| 63 | + shell: bash |
| 64 | + if: ${{ matrix.os != 'windows-latest' }} |
| 65 | + working-directory: build |
| 66 | + run: | |
| 67 | + cmake .. -G Ninja |
| 68 | + sudo cmake --build . --config Release --target install |
| 69 | +
|
| 70 | + - name: Finish install for Ubuntu |
| 71 | + shell: bash |
| 72 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 73 | + working-directory: build |
| 74 | + run: | |
| 75 | + sudo ldconfig |
| 76 | +
|
| 77 | + - name: Generate Parser Tests |
| 78 | + shell: bash |
| 79 | + working-directory: build |
| 80 | + run: | |
| 81 | + cmake .. -DBUILD_PARSER_TESTS=ON |
| 82 | + cmake --build . --config Release --target gen_parser_tests |
| 83 | +
|
| 84 | + - name: Run Parser Tests on Windows |
| 85 | + shell: bash |
| 86 | + if: ${{ matrix.os == 'windows-latest' }} |
| 87 | + working-directory: build |
| 88 | + continue-on-error: true |
| 89 | + run: | |
| 90 | + export PATH=$PATH:"/c/Program Files/srcML/bin" |
| 91 | + srcml.exe --parser-test test/parser/testsuite | tee ParserTest.log |
| 92 | + - name: Run Parser Tests on Ubuntu/macOS |
| 93 | + shell: bash |
| 94 | + if: ${{ matrix.os != 'windows-latest' }} |
| 95 | + working-directory: build |
| 96 | + continue-on-error: true |
| 97 | + run: | |
| 98 | + srcml --parser-test test/parser/testsuite | tee ParserTest.log |
| 99 | + - uses: actions/upload-artifact@v2 |
| 100 | + with: |
| 101 | + name: ParserTest.${{ runner.os }}.log |
| 102 | + path: build/ParserTest.log |
0 commit comments