|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +jobs: |
| 6 | + checkstyle: |
| 7 | + name: Checkstyle |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout source |
| 11 | + uses: actions/checkout@v1 |
| 12 | + with: |
| 13 | + depth: 1 |
| 14 | + submodules: false |
| 15 | + - name: Set up JDK |
| 16 | + uses: actions/setup-java@v1 |
| 17 | + with: |
| 18 | + java-version: 13 |
| 19 | + - uses: actions/cache@v1 |
| 20 | + name: Restore gradle chache |
| 21 | + with: |
| 22 | + path: ~/.gradle/caches |
| 23 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} |
| 24 | + restore-keys: | |
| 25 | + ${{ runner.OS }}-gradle-${{ env.cache-name }}- |
| 26 | + ${{ runner.OS }}-gradle- |
| 27 | + ${{ runner.OS }}- |
| 28 | + - uses: actions/cache@v1 |
| 29 | + name: Restore gradle wrapper |
| 30 | + with: |
| 31 | + path: ~/.gradle/wrapper |
| 32 | + key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| 33 | + - name: Run checkstyle |
| 34 | + run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh |
| 35 | + tests: |
| 36 | + name: Unit tests |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Checkout source |
| 40 | + uses: actions/checkout@v1 |
| 41 | + with: |
| 42 | + depth: 1 |
| 43 | + submodules: false |
| 44 | + - name: Set up JDK |
| 45 | + uses: actions/setup-java@v1 |
| 46 | + with: |
| 47 | + java-version: 13 |
| 48 | + - uses: actions/cache@v1 |
| 49 | + name: Restore gradle chache |
| 50 | + with: |
| 51 | + path: ~/.gradle/caches |
| 52 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} |
| 53 | + restore-keys: | |
| 54 | + ${{ runner.OS }}-gradle-${{ env.cache-name }}- |
| 55 | + ${{ runner.OS }}-gradle- |
| 56 | + ${{ runner.OS }}- |
| 57 | + - uses: actions/cache@v1 |
| 58 | + name: Restore gradle wrapper |
| 59 | + with: |
| 60 | + path: ~/.gradle/wrapper |
| 61 | + key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| 62 | + - name: Run tests |
| 63 | + run: xvfb-run --auto-servernum ./gradlew check -x checkstyleJmh -x checkstyleMain -x checkstyleTest |
| 64 | + env: |
| 65 | + CI: "true" |
| 66 | + - name: Format failed test results |
| 67 | + if: failure() |
| 68 | + run: | |
| 69 | + sudo apt-get install -qq -y xml-twig-tools xsltproc |
| 70 | + scripts/after-failure.sh |
| 71 | + databasetests: |
| 72 | + name: Database tests |
| 73 | + runs-on: ubuntu-latest |
| 74 | + services: |
| 75 | + postgres: |
| 76 | + image: postgres:10.8 |
| 77 | + env: |
| 78 | + POSTGRES_USER: postgres |
| 79 | + POSTGRES_PASSWORD: postgres |
| 80 | + POSTGRES_DB: postgres |
| 81 | + ports: |
| 82 | + - 5432:5432 |
| 83 | + # needed because the postgres container does not provide a healthcheck |
| 84 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 85 | + steps: |
| 86 | + - name: Checkout source |
| 87 | + uses: actions/checkout@v1 |
| 88 | + with: |
| 89 | + depth: 1 |
| 90 | + submodules: false |
| 91 | + - name: Set up JDK |
| 92 | + uses: actions/setup-java@v1 |
| 93 | + with: |
| 94 | + java-version: 13 |
| 95 | + - uses: actions/cache@v1 |
| 96 | + name: Restore gradle chache |
| 97 | + with: |
| 98 | + path: ~/.gradle/caches |
| 99 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} |
| 100 | + restore-keys: | |
| 101 | + ${{ runner.OS }}-gradle-${{ env.cache-name }}- |
| 102 | + ${{ runner.OS }}-gradle- |
| 103 | + ${{ runner.OS }}- |
| 104 | + - uses: actions/cache@v1 |
| 105 | + name: Restore gradle wrapper |
| 106 | + with: |
| 107 | + path: ~/.gradle/wrapper |
| 108 | + key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| 109 | + - name: Run tests on PostgreSQL |
| 110 | + run: ./gradlew databaseTest --rerun-tasks |
| 111 | + env: |
| 112 | + CI: "true" |
| 113 | + DBMS: "postgresql" |
| 114 | + - name: Shutdown Ubuntu MySQL |
| 115 | + run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it |
| 116 | + - name: Start custom MySQL |
| 117 | + uses: mirromutth/[email protected] |
| 118 | + with: |
| 119 | + host port: 3800 |
| 120 | + container port: 3307 |
| 121 | + character set server: 'utf8' |
| 122 | + collation server: 'utf8_general_ci' |
| 123 | + mysql version: '8.0' |
| 124 | + mysql database: 'jabref' |
| 125 | + mysql root password: 'root' |
| 126 | + - name: Run tests on MySQL |
| 127 | + run: ./gradlew databaseTest --rerun-tasks |
| 128 | + env: |
| 129 | + CI: "true" |
| 130 | + DBMS: "mysql" |
| 131 | + fetchertests: |
| 132 | + name: Fetcher tests |
| 133 | + runs-on: ubuntu-latest |
| 134 | + steps: |
| 135 | + - name: Checkout source |
| 136 | + uses: actions/checkout@v1 |
| 137 | + with: |
| 138 | + depth: 1 |
| 139 | + submodules: false |
| 140 | + - name: Set up JDK |
| 141 | + uses: actions/setup-java@v1 |
| 142 | + with: |
| 143 | + java-version: 13 |
| 144 | + - uses: actions/cache@v1 |
| 145 | + name: Restore gradle chache |
| 146 | + with: |
| 147 | + path: ~/.gradle/caches |
| 148 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} |
| 149 | + restore-keys: | |
| 150 | + ${{ runner.OS }}-gradle-${{ env.cache-name }}- |
| 151 | + ${{ runner.OS }}-gradle- |
| 152 | + ${{ runner.OS }}- |
| 153 | + - uses: actions/cache@v1 |
| 154 | + name: Restore gradle wrapper |
| 155 | + with: |
| 156 | + path: ~/.gradle/wrapper |
| 157 | + key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| 158 | + - name: Run fetcher tests |
| 159 | + run: ./gradlew fetcherTest |
| 160 | + env: |
| 161 | + CI: "true" |
| 162 | + guitests: |
| 163 | + name: GUI tests |
| 164 | + runs-on: ubuntu-latest |
| 165 | + steps: |
| 166 | + - name: Checkout source |
| 167 | + uses: actions/checkout@v1 |
| 168 | + with: |
| 169 | + depth: 1 |
| 170 | + submodules: false |
| 171 | + - name: Set up JDK |
| 172 | + uses: actions/setup-java@v1 |
| 173 | + with: |
| 174 | + java-version: 13 |
| 175 | + - uses: actions/cache@v1 |
| 176 | + name: Restore gradle chache |
| 177 | + with: |
| 178 | + path: ~/.gradle/caches |
| 179 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} |
| 180 | + restore-keys: | |
| 181 | + ${{ runner.OS }}-gradle-${{ env.cache-name }}- |
| 182 | + ${{ runner.OS }}-gradle- |
| 183 | + ${{ runner.OS }}- |
| 184 | + - uses: actions/cache@v1 |
| 185 | + name: Restore gradle wrapper |
| 186 | + with: |
| 187 | + path: ~/.gradle/wrapper |
| 188 | + key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| 189 | + - name: Run GUI tests |
| 190 | + run: xvfb-run --auto-servernum ./gradlew guiTest |
| 191 | + env: |
| 192 | + CI: "true" |
| 193 | + codecoverage: |
| 194 | + name: Code coverage |
| 195 | + runs-on: ubuntu-latest |
| 196 | + services: |
| 197 | + postgres: |
| 198 | + image: postgres:10.8 |
| 199 | + env: |
| 200 | + POSTGRES_USER: postgres |
| 201 | + POSTGRES_PASSWORD: postgres |
| 202 | + POSTGRES_DB: postgres |
| 203 | + ports: |
| 204 | + - 5432:5432 |
| 205 | + # needed because the postgres container does not provide a healthcheck |
| 206 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 207 | + steps: |
| 208 | + - name: Checkout source |
| 209 | + uses: actions/checkout@v1 |
| 210 | + with: |
| 211 | + depth: 1 |
| 212 | + submodules: false |
| 213 | + - name: Set up JDK |
| 214 | + uses: actions/setup-java@v1 |
| 215 | + with: |
| 216 | + java-version: 13 |
| 217 | + - uses: actions/cache@v1 |
| 218 | + name: Restore gradle chache |
| 219 | + with: |
| 220 | + path: ~/.gradle/caches |
| 221 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} |
| 222 | + restore-keys: | |
| 223 | + ${{ runner.OS }}-gradle-${{ env.cache-name }}- |
| 224 | + ${{ runner.OS }}-gradle- |
| 225 | + ${{ runner.OS }}- |
| 226 | + - uses: actions/cache@v1 |
| 227 | + name: Restore gradle wrapper |
| 228 | + with: |
| 229 | + path: ~/.gradle/wrapper |
| 230 | + key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} |
| 231 | + - name: Update test coverage metrics |
| 232 | + run: xvfb-run --auto-servernum ./gradlew jacocoTestReport && bash <(curl -s https://codecov.io/bash); |
| 233 | + env: |
| 234 | + CI: "false" # we pretend to run locally - even if tests fail on the CI, they count towards test coverage |
| 235 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 236 | + DBMS: "postgresql" |
0 commit comments