Skip to content

Commit

Permalink
Rename universities to no longer use a prefix to be compatible with t…
Browse files Browse the repository at this point in the history
…he contest package format

Rename all image files. Update the organizations. Add contest package to the export script. Modify the automation logic to import the contest package using the `import-contest` script.
  • Loading branch information
verwoerd committed Oct 21, 2024
1 parent a20082b commit 48919bf
Show file tree
Hide file tree
Showing 90 changed files with 285 additions and 196 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/domjudge/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Thanks to Verwoerd
# https://github.com/Programming-Contest-Foundation/logo/blob/main/domjudge/docker-compose.yml

version: '3'

services:
mariadb:
image: mariadb
Expand All @@ -18,20 +15,37 @@ services:
volumes:
- /var/lib/mysql
domjudge:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:12345"]
interval: 30s
timeout: 5s
retries: 3
start_period: 1m
image: domjudge/domserver
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost:12345"]
# interval: 30s
# timeout: 5s
# retries: 3
# start_period: 1m
image: ghcr.io/wisvch/domjudge-packaging/domserver
hostname: domserver
depends_on:
- mariadb
environment:
- DJ_DB_INSTALL_BARE=1
ports:
- 12345:80
volumes:
- ${PWD}/affilDOMjudge:/opt/domjudge/domserver/webapp/public/images/affiliations
- ${PWD}/out/contest-package:/tmp/icpc-logos
# entrypoint: ["/bin/bash","-c","sleep 1m && /scripts/start.sh"]
# hostname: domserver
# #privileged: true
# cds:
# image: ghcr.io/icpctools/cds:2.6.1161
# depends_on:
# - domjudge
# ports:
# - 12346:8080
# - 12347:8443
# environment:
# - ADMIN_PASSWORD=blaat123
# - PRESENTATION_PASSWORD=blaat123
# - CCS_URL=http://domserver/api/contests/demo
# - CCS_USER=feed
# - CCS_PASSWORD=blaat123123
# volumes:
# - ../../../out/contest-package:/contest
16 changes: 16 additions & 0 deletions .github/workflows/generate-metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
pwd
cd out/contest-package
jq "[.[] | {\"organization_id\": .id, \"name\": .formal_name, \"id\":1, \"group_ids\": [\"3\"], \"external_id\": .id, \"display_name\": .formal_name}] | to_entries | map( (.value.id = \"\(1+.key)\" ) | .value)" organizations.json > teams.json
cat > contest.yaml <<<"id: 1
name: demo
title: demo
short-name: demo
start-time: 2024-10-21T00:00:00.000Z
duration: 5:00:00
scoreboard_freeze_duration: 1:00:00
scoreboard_type: pass-fail
penalty_time: 20
"
cat > groups.json <<<"[{\"id\":\"3\",\"icpc_id\":\"3\",\"name\":\"Contestants\"}]"
cd ../..
24 changes: 12 additions & 12 deletions .github/workflows/make_logos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Run export
run: ./export.sh --universities --companies --studies --background --transparent --output-directory out 64 256
run: ./export.sh --universities --companies --studies --contest-package --background --transparent --output-directory out 64 256
- uses: actions/upload-artifact@v4
with:
name: logos
Expand All @@ -30,7 +30,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v4.1.7
- uses: actions/download-artifact@v4
with:
name: logos
path: out
Expand All @@ -39,28 +39,20 @@ jobs:
- name: Test in DJ
run: |
cd ${{ github.workspace }}
afftmp="affilDOMjudge"
./.github/workflows/generate-metadata.sh
sudo apt update; sudo apt install cutycapt xvfb httpie -y
mkdir $afftmp
cp ${{ github.workspace }}/out/background_64/* $afftmp
docker compose -f .github/workflows/domjudge/docker-compose.yml up -d mariadb
sleep 30s
docker compose -f .github/workflows/domjudge/docker-compose.yml up -d domjudge
sleep 1m
ADMINPASS=$(docker exec -i domjudge-domjudge-1 cat /opt/domjudge/domserver/etc/initial_admin_password.secret)
http -a admin:$ADMINPASS --check-status -b -f POST "http://localhost:12345/api/users/organizations" json@out/organizations.json
jq "[.[] | {\"organization_id\": .id, \"name\": .formal_name, \"id\":1, \"group_ids\": [\"3\"]}] | to_entries | map( (.value.id = \"\(1+.key)\" ) | .value)" out/organizations.json > teams.json
http -a admin:$ADMINPASS --check-status -b -f POST "http://localhost:12345/api/users/teams" [email protected]
http -a admin:$ADMINPASS --check-status -b PUT "http://localhost:12345/api/config" show_affiliation_logos=true show_flags=true show_affiliations=true data_source=1 --ignore-stdin
http -a admin:$ADMINPASS --verbose --check-status -b GET "http://localhost:12345/api/config"
docker exec -w /tmp/icpc-logos domjudge-domjudge-1 /bin/bash -c "yes | import-contest"
xvfb-run --server-args="-screen 0, 1024x768x24" cutycapt --url=http://localhost:12345 --out=scoreboard.png
- uses: actions/upload-artifact@v4
with:
name: DJ_scoreboard
path: scoreboard.png
release:
needs: render
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand All @@ -71,7 +63,15 @@ jobs:
path: out
- name: Zip logos
run: cd ${{ github.workspace }}/out; for i in */; do zip -r "${i%/}.zip" "$i"; done; cd ${{ github.workspace }}
- name: Zip contest package
run: cd ${{ github.workspace }}/out; zip -r contest-package.zip contest-package/ cd ${{ github.workspace }}
- uses: actions/upload-artifact@v4
if: github.ref != 'refs/heads/main'
with:
name: zips
path: out/*.zip
- uses: "marvinpinto/action-automatic-releases@latest"
if: github.ref == 'refs/heads/main'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/venv/
/out/
/.fleet/
/tmp/
/.idea/
Loading

0 comments on commit 48919bf

Please sign in to comment.