aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/test-push.yml
blob: f1c3b4e72d4784045496dfe56050f71ec6625c59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Run Tests
on: [push, pull_request]
jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        version: [7.0.0-jdk16, 7.2-jdk17]
    runs-on: ubuntu-20.04
    container:
      image: gradle:${{ matrix.version }}
      options: --user root
    steps:
      - uses: actions/checkout@v2
      - uses: gradle/wrapper-validation-action@v1
      - run: gradle build check -x test --stacktrace

  # This job is used to feed the test matrix of next job to allow the tests to run in parallel
  prepare_test_matrix:
    # Lets wait to ensure it builds before going running tests
    needs: build

    runs-on: ubuntu-20.04
    container:
      image: gradle:7.0.1-jdk16
      options: --user root

    steps:
      - uses: actions/checkout@v2
      - run: gradle writeActionsTestMatrix --stacktrace
      -
        id: set-matrix
        run: echo "::set-output name=matrix::$(cat build/test_matrix.json)"

    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}

  run_tests:
    needs: prepare_test_matrix

    strategy:
      fail-fast: false
      matrix:
        version: [7.0.0-jdk16, 7.2-jdk17]
        test: ${{ fromJson(needs.prepare_test_matrix.outputs.matrix) }}

    runs-on: ubuntu-20.04
    container:
      image: gradle:${{ matrix.version }}
      options: --user root

    steps:
      - uses: actions/checkout@v2
      - run: gradle test --tests ${{ matrix.test }} --stacktrace
        env:
          TEST_WARNING_MODE: fail

      - uses: actions/upload-artifact@v2
        if: ${{ failure() }}
        with:
          name: ${{ matrix.test }} (${{ matrix.java }}) Results
          path: build/reports/

  run_tests_windows:
    needs: prepare_test_matrix

    strategy:
      fail-fast: false
      matrix:
        java: [16]
        test: ${{ fromJson(needs.prepare_test_matrix.outputs.matrix) }}

    runs-on: windows-2019

    steps:
      - uses: actions/checkout@v2
      - name: setup jdk ${{ matrix.java }}
        uses: actions/setup-java@v1
        with:
          java-version: ${{ matrix.java }}
      - run: ./gradlew test --tests ${{ matrix.test }} --stacktrace
        env:
          TEST_WARNING_MODE: fail

      - uses: actions/upload-artifact@v2
        if: ${{ failure() }}
        with:
          name: ${{ matrix.test }} (${{ matrix.java }}) Results
          path: build/reports/

  # Special case this test to run across all os's
  reproducible_build_test:
    needs: build

    strategy:
      fail-fast: false
      matrix:
        java: [ 16 ]
        os: [ windows-2019, ubuntu-20.04, macos-10.15 ]

    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: ${{ matrix.java }}

      - run: ./gradlew test --tests *ReproducibleBuildTest --stacktrace

      - uses: actions/upload-artifact@v2
        if: ${{ failure() }}
        with:
          name: Reproducible Build ${{ matrix.os }} (${{ matrix.java }}) Results
          path: build/reports/

  bootstrap_tests:
    needs: build

    strategy:
      fail-fast: false
      matrix:
        java: [ 8, 11, 15, 16 ]
        gradle: [ 4.9, 5.2, 6.0.1, 6.9, 7.0.2 ]
        exclude:
          - java: 16
            gradle: 6.9
          - java: 16
            gradle: 6.0.1
          - java: 16
            gradle: 5.2
          - java: 16
            gradle: 4.9
          - java: 15
            gradle: 6.0.1
          - java: 15
            gradle: 5.2
          - java: 15
            gradle: 4.9
    runs-on: ubuntu-20.04
    container:
      image: gradle:7.0.2-jdk16
      options: --user root

    steps:
      # Build loom and publish to maven local
      - uses: actions/checkout@v2
      - run: gradle build publishToMavenLocal -x test -x check

      - run: gradle wrapper --gradle-version=${{ matrix.gradle }}
        working-directory: bootstrap/test-project
      - run: gradle --stop

      - uses: actions/setup-java@v2
        with:
          java-version: ${{ matrix.java }}
          distribution: 'adopt'

      - run: ./gradlew --version
        working-directory: bootstrap/test-project
      - run: ./gradlew build || true
        working-directory: bootstrap/test-project

      # TODO check the output of the previous step here