|
| 1 | +--- |
| 2 | +name: Package Linux arm64 |
| 3 | + |
| 4 | +on: workflow_dispatch |
| 5 | + |
| 6 | +jobs: |
| 7 | + package-linux: |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + distribution: |
| 11 | + - "fedora:rawhide" |
| 12 | + - "fedora:35" |
| 13 | + - "fedora:latest" |
| 14 | + - "fedora:34" |
| 15 | + - "fedora:33" |
| 16 | + - "fedora:32" |
| 17 | + - "centos:8" |
| 18 | + - "centos:7" |
| 19 | + - "ubuntu:21.10" |
| 20 | + - "ubuntu:21.04" |
| 21 | + - "ubuntu:20.10" |
| 22 | + - "ubuntu:20.04" |
| 23 | + - "ubuntu:18.04" |
| 24 | + - "ubuntu:16.04" |
| 25 | + - "ubuntu:14.04" |
| 26 | + - "opensuse:latest" |
| 27 | + - "opensuse:15.3" |
| 28 | + - "opensuse:15.2" |
| 29 | + - "opensuse:15.1" |
| 30 | + runs-on: [self-hosted] |
| 31 | + continue-on-error: true |
| 32 | + container: |
| 33 | + image: srcml/${{ matrix.distribution }} |
| 34 | + options: --platform linux/arm64 |
| 35 | + steps: |
| 36 | + |
| 37 | + - name: Checkout Repository |
| 38 | + uses: actions/checkout@v2 |
| 39 | + |
| 40 | + - name: OS Version |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + cat /etc/os-release |
| 44 | + export VALUE=$(echo ${{ matrix.distribution }} | tr ':' '-') |
| 45 | + echo "LABEL=$VALUE" >> $GITHUB_ENV |
| 46 | +
|
| 47 | + - name: Setup Ubuntu |
| 48 | + if: ${{ contains(matrix.distribution, 'ubuntu') }} |
| 49 | + shell: bash |
| 50 | + run: | |
| 51 | + echo "GENERATOR=DEB" >> $GITHUB_ENV |
| 52 | + echo "INSTALLCOMMAND=apt install -y" >> $GITHUB_ENV |
| 53 | + echo "EXTENSION=deb" >> $GITHUB_ENV |
| 54 | +
|
| 55 | + - name: Setup Fedora |
| 56 | + if: ${{ contains(matrix.distribution, 'fedora') }} |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + echo "GENERATOR=RPM" >> $GITHUB_ENV |
| 60 | + echo "INSTALLCOMMAND=dnf install -y" >> $GITHUB_ENV |
| 61 | + echo "EXTENSION=rpm" >> $GITHUB_ENV |
| 62 | +
|
| 63 | + - name: Setup CentOS |
| 64 | + if: ${{ contains(matrix.distribution, 'centos') }} |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + echo "GENERATOR=RPM" >> $GITHUB_ENV |
| 68 | + echo "INSTALLCOMMAND=yum install -y" >> $GITHUB_ENV |
| 69 | + echo "EXTENSION=rpm" >> $GITHUB_ENV |
| 70 | +
|
| 71 | + - name: Setup OpenSuse |
| 72 | + if: ${{ contains(matrix.distribution, 'opensuse') }} |
| 73 | + shell: bash |
| 74 | + run: | |
| 75 | + echo "GENERATOR=RPM" >> $GITHUB_ENV |
| 76 | + echo "INSTALLCOMMAND=zypper install -y --allow-unsigned-rpm" >> $GITHUB_ENV |
| 77 | + echo "EXTENSION=rpm" >> $GITHUB_ENV |
| 78 | +
|
| 79 | + - name: Create build directory |
| 80 | + shell: bash |
| 81 | + run: mkdir build |
| 82 | + |
| 83 | + - name: CMake Setup |
| 84 | + shell: bash |
| 85 | + working-directory: build |
| 86 | + run: | |
| 87 | + cmake .. -G Ninja |
| 88 | +
|
| 89 | + - name: Build |
| 90 | + shell: bash |
| 91 | + working-directory: build |
| 92 | + run: | |
| 93 | + ninja |
| 94 | +
|
| 95 | + - name: Package |
| 96 | + shell: bash |
| 97 | + working-directory: build |
| 98 | + run: | |
| 99 | + cpack -G ${{ env.GENERATOR }} |
| 100 | +
|
| 101 | + - uses: actions/upload-artifact@v2 |
| 102 | + continue-on-error: true |
| 103 | + with: |
| 104 | + name: Packages |
| 105 | + path: | |
| 106 | + build/dist/*.${{ env.EXTENSION }} |
| 107 | +
|
| 108 | + - name: Install |
| 109 | + shell: bash |
| 110 | + run: | |
| 111 | + ${{ env.INSTALLCOMMAND }} ./build/dist/srcml*.${{ env.EXTENSION }} |
| 112 | +
|
| 113 | + - name: Run Installed srcml |
| 114 | + shell: bash |
| 115 | + working-directory: build |
| 116 | + run: | |
| 117 | + srcml --version |
| 118 | + srcml --text="int a;" -l C++ |
| 119 | +
|
| 120 | + - name: Client Tests on Installed srcml |
| 121 | + shell: bash |
| 122 | + id: client |
| 123 | + working-directory: build |
| 124 | + continue-on-error: true |
| 125 | + run: | |
| 126 | + ctest -VV |
| 127 | + - name: Rename log file for upload |
| 128 | + run: cp build/Testing/Temporary/LastTest.log build/Testing/ClientTest.${{ env.LABEL }}.log |
| 129 | + - uses: actions/upload-artifact@v2 |
| 130 | + with: |
| 131 | + name: ClientTests |
| 132 | + path: build/Testing/ClientTest.${{ env.LABEL }}.log |
| 133 | + |
| 134 | + - name: Rerun any client test failures |
| 135 | + if: ${{ steps.client.outcome == 'failure' }} |
| 136 | + working-directory: build |
| 137 | + continue-on-error: true |
| 138 | + run: | |
| 139 | + ctest --rerun-failed -VV |
| 140 | +
|
| 141 | + - name: Build libsrcml Tests |
| 142 | + shell: bash |
| 143 | + working-directory: build |
| 144 | + continue-on-error: true |
| 145 | + run: | |
| 146 | + cmake .. -DBUILD_LIBSRCML_TESTS=ON |
| 147 | + cmake --build . --config Release --target build_libsrcml_tests |
| 148 | +
|
| 149 | + - name: Run libsrcml Tests on Installed libsrcml |
| 150 | + shell: bash |
| 151 | + working-directory: build |
| 152 | + continue-on-error: true |
| 153 | + run: | |
| 154 | + ctest -R ^test_ |
| 155 | + - run: cp build/Testing/Temporary/LastTest.log build/Testing/libsrcmlTest.${{ env.LABEL }}.log |
| 156 | + - uses: actions/upload-artifact@v2 |
| 157 | + with: |
| 158 | + name: libsrcmlTests |
| 159 | + path: build/Testing/libsrcmlTest.${{ env.LABEL }}.log |
| 160 | + |
| 161 | + - name: Generate Parser Tests |
| 162 | + shell: bash |
| 163 | + working-directory: build |
| 164 | + run: | |
| 165 | + cmake .. -DBUILD_PARSER_TESTS=ON |
| 166 | + cmake --build . --config Release --target gen_parser_tests |
| 167 | +
|
| 168 | + - name: Run Parser Tests |
| 169 | + shell: bash |
| 170 | + working-directory: build |
| 171 | + continue-on-error: true |
| 172 | + run: | |
| 173 | + srcml --dev --parser-test test/parser/testsuite | tee ParserTest.log |
| 174 | + - run: cp build/ParserTest.log build/libsrcmlTest.${{ env.LABEL }}.log |
| 175 | + - uses: actions/upload-artifact@v2 |
| 176 | + with: |
| 177 | + name: ParserTests |
| 178 | + path: build/libsrcmlTest.${{ env.LABEL }}.log |
0 commit comments