Unit tests #7426
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unit tests | |
| on: | |
| merge_group: | |
| pull_request: | |
| branches: | |
| - main | |
| - '[0-9]+.[0-9]+' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| unit-tests: | |
| permissions: | |
| checks: write | |
| runs-on: ubuntu-24.04 | |
| env: | |
| ADMIN_PASSWORD: admin_password | |
| MYSQL_ROOT_PASSWORD: mysql_root_password | |
| timeout-minutes: 30 | |
| container: | |
| image: domjudge/gitlabci:24.04 | |
| services: | |
| sqlserver: | |
| image: mariadb | |
| ports: | |
| - 3306:3306 | |
| env: | |
| MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }} | |
| options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| strategy: | |
| matrix: | |
| PHPVERSION: [8.2, 8.5] | |
| TEST: [Unit, E2E] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: webapp/node_modules | |
| key: npm-${{ hashFiles('webapp/package-lock.json') }} | |
| restore-keys: | | |
| npm- | |
| - name: Cache composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: webapp/vendor | |
| key: composer-${{ hashFiles('webapp/composer.lock') }} | |
| restore-keys: | | |
| composer- | |
| - name: info | |
| run: | | |
| cat /proc/cmdline && echo && | |
| cat /proc/mounts && echo && | |
| ls -al /sys/fs/cgroup && echo && | |
| uname -a && echo && | |
| stat -fc %T /sys/fs/cgroup && echo && | |
| cat /proc/self/cgroup && echo && | |
| cat /proc/cpuinfo | |
| - name: pstree | |
| run: pstree -p | |
| - name: Install DOMjudge | |
| run: .github/jobs/baseinstall.sh unit install ${{ matrix.PHPVERSION }} test | |
| - name: Check nginx | |
| run: curl -v https://localhost/domjudge/ | |
| - name: Run the unit-tests | |
| run: .github/jobs/unit-tests.sh ${{ matrix.PHPVERSION }} ${{ matrix.TEST }} | |
| - name: Publish Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: ${{ !cancelled() }} | |
| with: | |
| comment_mode: changes in failures | |
| check_name: unit-tests-${{ matrix.PHPVERSION }}-${{ matrix.TEST }}.xml | |
| files: unit-tests-${{ matrix.PHPVERSION }}-${{ matrix.TEST }}.xml | |
| - name: Get SQL logs | |
| run: docker logs "${{ job.services.sqlserver.id }}" | |
| - name: Collect docker logs on failure | |
| if: ${{ !cancelled() }} | |
| uses: jwalton/gh-docker-logs@v1 | |
| with: | |
| dest: '/tmp/docker-logs' | |
| - name: Upload all logs/artifacts | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Logs-${{ matrix.PHPVERSION }}-${{ matrix.TEST }} | |
| path: | | |
| /var/log/nginx | |
| /opt/domjudge/domserver/webapp/var/log/*.log | |
| /tmp/docker-logs | |
| /tmp/artifacts | |
| event_file: | |
| name: "Post results assuming forks" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Event File | |
| path: ${{ github.event_path }} |