| name: Rhino CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| permissions: read-all | |
| env: | |
| GRADLE_OPTS: "--enable-native-access=ALL-UNNAMED" | |
| jobs: | |
| # First, "official" test: Build on Java 25, test on Java 17, compare test262.properties | |
| # to see if tests are passing that are currently disabled. | |
| test: | |
| runs-on: ubuntu-latest | |
| name: Test 262 Verification | |
| steps: | |
| - name: Check out Rhino | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2 | |
| - name: Check out test262 | |
| run: git submodule update --init --single-branch | |
| - name: Set up Java | |
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 | |
| with: | |
| java-version: | | |
| 17 | |
| 25 | |
| distribution: 'adopt' | |
| - name: Check current state of test262.properties | |
| id: hashBefore | |
| run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT | |
| - name: Run test262 tests | |
| # Currently Java 17 is required to have a reproducible result | |
| env: | |
| RHINO_TEST_JAVA_VERSION: "17" | |
| run: >- | |
| ./gradlew check -DupdateTest262properties | |
| - name: Upload results | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| if: ${{ always() }} | |
| with: | |
| name: reports-java | |
| path: '*/build/reports' | |
| - name: Check updated state of test262.properties | |
| id: hashAfter | |
| run: echo "hash=${{ hashFiles('./tests/testsrc/test262.properties') }}" >> $GITHUB_OUTPUT | |
| - name: Compare test262 results | |
| run: | | |
| if [ "${{ steps.hashBefore.outputs.hash }}" != "${{ steps.hashAfter.outputs.hash }}" ]; then | |
| echo "The test262.properties file was not updated properly." | |
| echo "Please follow the instructions in tests/README.md to update it." | |
| git --no-pager diff ./tests/testsrc/test262.properties | |
| exit 1 | |
| else | |
| echo "The test262.properties file is up to date." | |
| fi | |
| # Test various combinations of building and testing | |
| matrix-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - java-version: "21" | |
| test-java-version: "21" | |
| name: "Java 21 Build and Test" | |
| multithread: false | |
| debug: false | |
| - java-version: "25" | |
| test-java-version: "25" | |
| name: "Java 25 Build and Test" | |
| multithread: false | |
| debug: false | |
| - java-version: "25" | |
| test-java-version: "25" | |
| name: "Java 25 Multithreaded" | |
| multithread: true | |
| debug: false | |
| - java-version: "25" | |
| test-java-version: "25" | |
| name: "Java 25 Debug" | |
| multithread: false | |
| debug: true | |
| name: ${{ matrix.name }} | |
| steps: | |
| - name: Check out Rhino | |
| uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2 | |
| - name: Check out test262 | |
| run: git submodule update --init --single-branch | |
| - name: Set up Java | |
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 | |
| with: | |
| java-version: | | |
| ${{ matrix.test-java-version }} | |
| ${{ matrix.java-version }} | |
| distribution: 'adopt' | |
| - name: Build and test ${{ matrix.name }} | |
| env: | |
| RHINO_TEST_JAVA_VERSION: ${{ matrix.test-java-version }} | |
| run: >- | |
| ./gradlew check ${{ matrix.multithread && '-Drhino.useThreadSafeObjectsByDefault=true' || '' }} ${{ matrix.debug && '-DrunTest262Debug' || '' }} | |
| - name: Upload results ${{ matrix.name }} | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| if: ${{ always() }} | |
| with: | |
| name: reports-java-${{ matrix.java-version }}-${{ matrix.test-java-version}}${{ matrix.multithread }} | |
| path: '*/build/reports' |