diff --git a/gitlab/jsontogitlab.py b/.github/jobs/jsontogitlab.py similarity index 100% rename from gitlab/jsontogitlab.py rename to .github/jobs/jsontogitlab.py diff --git a/.github/jobs/webstandard.sh b/.github/jobs/webstandard.sh index 66d5641aa6..8e5f81a9c2 100755 --- a/.github/jobs/webstandard.sh +++ b/.github/jobs/webstandard.sh @@ -123,7 +123,7 @@ if [ "$TEST" = "w3cval" ]; then NEWFOUNDERRORS=$("$DIR"/vnu-runtime-image/bin/vnu --errors-only --exit-zero-always --skip-non-$typ --format gnu $FLTR "$URL" 2>&1 | wc -l) FOUNDERR=$((NEWFOUNDERRORS+FOUNDERR)) python3 -m "json.tool" < result.json > "$ARTIFACTS/w3c$typ$URL.json" - trace_off; python3 gitlab/jsontogitlab.py "$ARTIFACTS/w3c$typ$URL.json"; trace_on + trace_off; python3 .github/jobs/jsontogitlab.py "$ARTIFACTS/w3c$typ$URL.json"; trace_on section_end done else diff --git a/gitlab/base.sh b/gitlab/base.sh deleted file mode 100755 index 65d19188bc..0000000000 --- a/gitlab/base.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -. gitlab/ci_settings.sh - -# If this script is called from unit.sh, we use the test environment -export APP_ENV="${1:-prod}" - -# In the test environment, we need to use a different database -[ "$APP_ENV" = "prod" ] && DATABASE_NAME=domjudge || DATABASE_NAME=domjudge_test - -lsb_release -a - -# FIXME: This chicken-egg problem is annoying but let us bootstrap for now. -echo "CREATE DATABASE IF NOT EXISTS \`${DATABASE_NAME}\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" | mysql -echo "CREATE USER 'domjudge'@'%' IDENTIFIED BY 'domjudge';" | mysql -echo "GRANT SELECT, INSERT, UPDATE, DELETE ON \`${DATABASE_NAME}\`.* TO 'domjudge'@'%';" | mysql - -# Increase max_allowed_packet for following connections. -echo "SET GLOBAL max_allowed_packet = 100*1024*1024;" | mysql - -# Test that SQL upgrade scripts also work with this setting -if [ -n "${MYSQL_REQUIRE_PRIMARY_KEY:-}" ]; then - echo 'SET GLOBAL sql_require_primary_key = 1;' | mysql -fi - -# Generate a dbpasswords file -# Note that this does not use ${DATABASE_NAME} since Symfony adds the _test postfix itself -echo "unused:sqlserver:domjudge:domjudge:domjudge:3306" > etc/dbpasswords.secret - -# Generate APP_SECRET for symfony -# shellcheck disable=SC2164 -( cd etc ; ./gensymfonysecret > symfony_app.secret ) - -cat > webapp/config/static.yaml <> ~www-data/.netrc -sudo -Eu www-data bin/dj_setup_database -uroot -p${MYSQL_ROOT_PASSWORD} bare-install - -# shellcheck disable=SC2154 -if [ -n "${integration:-}" ]; then - # Make sure admin has a team associated to insert submissions as well. - echo "UPDATE user SET teamid=1 WHERE userid=1;" | mysql domjudge -elif [ -n "${unit:-}" ]; then - # Make sure admin has no team associated so we will not insert submissions during unit tests. - echo "UPDATE user SET teamid=null WHERE userid=1;" | mysql domjudge_test -fi - -sudo -Eu www-data bin/dj_setup_database -uroot -p${MYSQL_ROOT_PASSWORD} install-examples diff --git a/gitlab/ci/template.yml b/gitlab/ci/template.yml deleted file mode 100644 index e810df854c..0000000000 --- a/gitlab/ci/template.yml +++ /dev/null @@ -1,64 +0,0 @@ -# This placeholder job tries to start as soon as possible -.clean_ordering: - needs: [] - retry: - max: 2 #Max is 2, set when gitlab is flacky - when: - - always - script: - - /bin/true - -.tiny_job: - extends: [.clean_ordering] - timeout: 4m - -.short_job: - extends: [.clean_ordering] - timeout: 7m - -.normal_job: - extends: [.clean_ordering] - timeout: 20m - -.long_job: - extends: [.clean_ordering] - timeout: 30m - -.cached_vendor: - extends: [.clean_ordering] - cache: - key: webappvendor-20240623 - paths: - - webapp/vendor/ - -.mysql_job: - script: - - /bin/true - services: - - name: mysql - alias: sqlserver - -.mariadb_job: - script: - - /bin/true - services: - - name: mariadb - alias: sqlserver - -.phpsupported_job: - script: - - /bin/true - parallel: - matrix: - - PHPVERSION: ["8.1","8.2","8.3", "8.4"] - TEST: ["E2E","Unit"] - CRAWL_SHADOW_MODE: ["0","1"] - -.phpsupported_job_pr: - script: - - /bin/true - parallel: - matrix: - - PHPVERSION: ["8.3"] - TEST: ["E2E","Unit"] - CRAWL_SHADOW_MODE: ["0"] diff --git a/gitlab/ci/unit.yml b/gitlab/ci/unit.yml deleted file mode 100644 index 5bf7aab8c7..0000000000 --- a/gitlab/ci/unit.yml +++ /dev/null @@ -1,42 +0,0 @@ -.unit_job: - extends: [.normal_job,.cached_vendor] - stage: unit - # Disabled for now as it drastically speeds up running unit tests and we don't use it yet - # before_script: - # - apt-get update -yqq - # - apt-get install php-xdebug -yqq - variables: - MYSQL_ROOT_PASSWORD: password - MARIADB_PORT_3306_TCP_ADDR: sqlserver - script: - - set -eux - - if [ -z ${PHPVERSION+x} ]; then export PHPVERSION=8.1; fi - - if [ -z ${TEST+x} ]; then export TEST="UNIT"; fi - - if [ "$TEST" = "UNIT" ] && [ "$CRAWL_SHADOW_MODE" != "0" ]; then exit 0; fi - - if [ "$TEST" = "E2E" ] && [ "$CRAWL_SHADOW_MODE" != "0" ] && [ "$CI_COMMIT_BRANCH" != "main" ]; then exit 0; fi - - export CRAWL_SHADOW_MODE - - ./gitlab/unit-tests.sh $PHPVERSION $TEST - artifacts: - when: always - paths: - - unit-tests.xml - - coverage-html - - deprecation.txt - - duration - - gitlabartifacts - reports: - junit: - - unit-tests.xml - -run unit tests: - extends: [.mariadb_job,.phpsupported_job,.unit_job] - -run unit tests (PR): - extends: [.mariadb_job,.phpsupported_job_pr,.unit_job] - -run unit tests (MySQL): - extends: [.mysql_job,.unit_job] - parallel: - matrix: - - TEST: ["E2E","Unit"] - CRAWL_SHADOW_MODE: ["0"] diff --git a/gitlab/ci_settings.sh b/gitlab/ci_settings.sh deleted file mode 100755 index dfea8a1925..0000000000 --- a/gitlab/ci_settings.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# Fail pipeline when variable is not set or individual command has an non-zero exitcode. -set -euo pipefail - -shopt -s expand_aliases - -# Shared constants between jobs -DIR=$(pwd) -GITSHA=$(git rev-parse HEAD || true) -export DIR -export GITSHA -export PS4='(${BASH_SOURCE}:${LINENO}): - [$?] $ ' -export LOGFILE="/opt/domjudge/domserver/webapp/var/log/prod.log" - -CCS_SPECS_PINNED_SHA1='a68aff54c4e60fc2bff2fc5c36c119bffa4d30f1' - -# Shared storage for all artifacts -export GITLABARTIFACTS="$DIR/gitlabartifacts" -mkdir -p "$GITLABARTIFACTS" - -# Functions to annotate the GitLab logs -alias trace_on='set -x' -alias trace_off='{ set +x; } 2>/dev/null' -function section_start_internal() { - echo -e "section_start:$(date +%s):$2[collapsed=$1]\r\e[0K$3" - trace_on -} -function section_end_internal() { - echo -e "section_end:$(date +%s):$1\r\e[0K" - trace_on -} -alias section_start_collap='trace_off ; section_start_internal true' -alias section_start='trace_off ; section_start_internal false' -alias section_end='trace_off ; section_end_internal ' - -function log_on_err() { - echo -e "\\n\\n=======================================================\\n" - echo "Symfony log:" - if sudo test -f "$LOGFILE" ; then - sudo cat "$LOGFILE" - fi -} - -function show_phpinfo() { - phpversion=$1 - section_start_collap phpinfo "Show the new PHP info" - update-alternatives --set php /usr/bin/php"${phpversion}" - php -v - php -m - section_end phpinfo -} - -# Show running command -set -x diff --git a/gitlab/default-nginx b/gitlab/default-nginx deleted file mode 100644 index f27f32a0ec..0000000000 --- a/gitlab/default-nginx +++ /dev/null @@ -1,12 +0,0 @@ -server { - listen 80 default_server; - listen [::]:80 default_server; - root /var/www/html; - index index.html index.htm index.nginx-debian.html; - server_name _; - location / { - # First attempt to serve request as file, then - # as directory, then fall back to displaying a 404. - try_files $uri $uri/ =404; - } -}