|
| 1 | +# This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | +# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | +# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 | +# |
| 5 | +# Copyright (c) 2011-2020 ETH Zurich. |
| 6 | + |
| 7 | +name: test |
| 8 | + |
| 9 | +on: [push] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-and-test-server: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + container: gobraverifier/gobra-base:v2 |
| 15 | + steps: |
| 16 | + - name: Checkout Gobra-IDE |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + path: gobra-ide |
| 20 | + |
| 21 | + # clone Viper dependencies |
| 22 | + - name: Checkout Gobra |
| 23 | + uses: actions/checkout@v2 |
| 24 | + with: |
| 25 | + repository: viperproject/gobra |
| 26 | + path: gobra |
| 27 | + - name: Checkout Silver |
| 28 | + uses: actions/checkout@v2 |
| 29 | + with: |
| 30 | + repository: viperproject/silver |
| 31 | + path: silver |
| 32 | + - name: Checkout Silicon |
| 33 | + uses: actions/checkout@v2 |
| 34 | + with: |
| 35 | + repository: viperproject/silicon |
| 36 | + path: silicon |
| 37 | + - name: Checkout Carbon |
| 38 | + uses: actions/checkout@v2 |
| 39 | + with: |
| 40 | + repository: viperproject/carbon |
| 41 | + path: carbon |
| 42 | + - name: Checkout ViperServer |
| 43 | + uses: actions/checkout@v2 |
| 44 | + with: |
| 45 | + repository: viperproject/viperserver |
| 46 | + path: viperserver |
| 47 | + |
| 48 | + - name: Java Version |
| 49 | + run: java --version |
| 50 | + - name: Z3 Version |
| 51 | + run: z3 -version |
| 52 | + - name: Silver Commit |
| 53 | + run: echo "Silver commit:" $(git -C silver rev-parse HEAD) |
| 54 | + - name: Silicon Commit |
| 55 | + run: echo "Silicon commit:" $(git -C silicon rev-parse HEAD) |
| 56 | + - name: Carbon Commit |
| 57 | + run: echo "Carbon commit:" $(git -C carbon rev-parse HEAD) |
| 58 | + - name: ViperServer Commit |
| 59 | + run: echo "ViperServer commit:" $(git -C viperserver rev-parse HEAD) |
| 60 | + - name: Gobra Commit |
| 61 | + run: echo "Gobra commit:" $(git -C gobra rev-parse HEAD) |
| 62 | + |
| 63 | + # create symlinks between and to Viper dependencies: |
| 64 | + - name: Create Silicon's sym links |
| 65 | + run: ln --symbolic ../silver |
| 66 | + working-directory: silicon |
| 67 | + - name: Create Carbon's sym links |
| 68 | + run: ln --symbolic ../silver |
| 69 | + working-directory: carbon |
| 70 | + - name: Create ViperServers's sym links |
| 71 | + run: ln --symbolic ../silver; ln --symbolic ../silicon; ln --symbolic ../carbon |
| 72 | + working-directory: viperserver |
| 73 | + - name: Create Gobra's sym links |
| 74 | + run: ln --symbolic ../silver; ln --symbolic ../silicon; ln --symbolic ../carbon; ln --symbolic ../viperserver |
| 75 | + working-directory: gobra |
| 76 | + - name: Create Gobra IDE's sym links |
| 77 | + run: ln --symbolic ../../gobra |
| 78 | + working-directory: gobra-ide/server |
| 79 | + |
| 80 | + - name: Cache SBT |
| 81 | + uses: actions/cache@v2 |
| 82 | + with: |
| 83 | + path: | |
| 84 | + ~/.ivy2/cache |
| 85 | + ~/.sbt |
| 86 | + key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }} |
| 87 | + |
| 88 | + - name: Assemble Gobra server |
| 89 | + run: sbt "set test in assembly := {}" clean assembly |
| 90 | + working-directory: gobra-ide/server |
| 91 | + |
| 92 | + - name: Upload Gobra server artifact |
| 93 | + uses: actions/upload-artifact@v2 |
| 94 | + with: |
| 95 | + name: server |
| 96 | + path: gobra-ide/server/target/scala-2.12/server.jar |
| 97 | + |
| 98 | + - name: Test Gobra server |
| 99 | + run: sbt test |
| 100 | + working-directory: gobra-ide/server |
| 101 | + |
| 102 | + build-and-test-client: |
| 103 | + needs: build-and-test-server |
| 104 | + strategy: |
| 105 | + # tests should not be stopped when they fail on one of the OSes: |
| 106 | + fail-fast: false |
| 107 | + matrix: |
| 108 | + os: [macos-latest, ubuntu-latest, windows-latest] |
| 109 | + runs-on: ${{ matrix.os }} |
| 110 | + steps: |
| 111 | + - name: Checkout Gobra-IDE |
| 112 | + uses: actions/checkout@v2 |
| 113 | + with: |
| 114 | + path: gobra-ide |
| 115 | + |
| 116 | + - name: Download Gobra server artifact |
| 117 | + uses: actions/download-artifact@v2 |
| 118 | + with: |
| 119 | + name: server |
| 120 | + # place artifact at the same location as the build has produced it: |
| 121 | + path: gobra-ide/server/target/scala-2.12 |
| 122 | + |
| 123 | + - name: Install Node.js |
| 124 | + uses: actions/setup-node@v1.4.3 |
| 125 | + with: |
| 126 | + node-version: '10' |
| 127 | + |
| 128 | + - name: Setup Java JDK |
| 129 | + uses: actions/setup-java@v1.4.2 |
| 130 | + with: |
| 131 | + java-version: '11' |
| 132 | + - run: java --version |
| 133 | + |
| 134 | + - run: npm ci --cache .npm --prefer-offline |
| 135 | + working-directory: gobra-ide/client |
| 136 | + |
| 137 | + - name: Start xvfb |
| 138 | + if: startsWith(matrix.os, 'ubuntu') |
| 139 | + run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo ">>> Started xvfb" |
| 140 | + |
| 141 | + - name: Run tests on Ubuntu |
| 142 | + if: startsWith(matrix.os, 'ubuntu') |
| 143 | + env: |
| 144 | + DISPLAY: ':99.0' |
| 145 | + # run tests as sudo on ubutunu as this is required to install the extension to VSCode: |
| 146 | + run: sudo npm test |
| 147 | + working-directory: gobra-ide/client |
| 148 | + - name: Run tests not on Ubuntu |
| 149 | + if: ${{ !startsWith(matrix.os, 'ubuntu') }} |
| 150 | + run: npm test |
| 151 | + working-directory: gobra-ide/client |
| 152 | + |
| 153 | + - name: Cache npm |
| 154 | + uses: actions/cache@v2 |
| 155 | + with: |
| 156 | + path: gobra-ide/client/.npm |
| 157 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 158 | + restore-keys: | |
| 159 | + ${{ runner.os }}-node- |
0 commit comments