From 458f7d428110d8c7358e09f9768f1d45abd0f8e9 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sat, 7 Dec 2024 18:22:20 +0100 Subject: [PATCH] Implement optionally running this --- .github/workflows/unit-tests.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 9a92e4d2d3..70f5f705b7 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -39,14 +39,18 @@ jobs: TEST: [Unit, E2E] steps: - name: Skip this job when not in a merge queue for some combinations + id: skip_check run: | if [ "${{ !contains(github.ref, 'gh-readonly-queue') }}" ]; then if [ "${{ matrix.PHPVERSION }}" -ne "8.4" ]; then - exit 0 + echo "::set-output name=skip::true" fi fi - - uses: actions/checkout@v4 + - name: Get the repository + if: steps.skip_check.outputs.run == 'true' + uses: actions/checkout@v4 - name: info + if: steps.skip_check.outputs.run == 'true' run: | cat /proc/cmdline && echo && cat /proc/mounts && echo && @@ -56,27 +60,32 @@ jobs: cat /proc/self/cgroup && echo && cat /proc/cpuinfo - name: pstree + if: steps.skip_check.outputs.run == 'true' run: pstree -p - name: Install DOMjudge + if: steps.skip_check.outputs.run == 'true' run: .github/jobs/baseinstall.sh unit install ${{ matrix.PHPVERSION }} test - name: Check nginx + if: steps.skip_check.outputs.run == 'true' run: curl -v https://localhost/domjudge/ - name: Run the unit-tests + if: steps.skip_check.outputs.run == 'true' run: .github/jobs/unit-tests.sh ${{ matrix.PHPVERSION }} ${{ matrix.TEST }} - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action@v2 - if: ${{ !cancelled() }} + if: "${{ steps.skip_check.outputs.run == 'true'}} && ${{ !cancelled() }}" with: files: /tmp/artifacts/unit-tests.xml - name: Get SQL logs + if: steps.skip_check.outputs.run == 'true' run: docker logs "${{ job.services.sqlserver.id }}" - name: Collect docker logs on failure - if: ${{ !cancelled() }} + if: "${{ steps.skip_check.outputs.run == 'true'}} && ${{ !cancelled() }}" uses: jwalton/gh-docker-logs@v1 with: dest: '/tmp/docker-logs' - name: Upload all logs/artifacts - if: ${{ !cancelled() }} + if: "${{ steps.skip_check.outputs.run == 'true'}} && ${{ !cancelled() }}" uses: actions/upload-artifact@v4 with: name: Logs @@ -86,6 +95,7 @@ jobs: /tmp/docker-logs /tmp/artifacts - name: Verify no errors in prod.log + if: steps.skip_check.outputs.run == 'true' shell: bash run: | if cat /opt/domjudge/domserver/webapp/var/log/*.log | egrep '(CRITICAL|ERROR):'; then