Skip to content

Commit

Permalink
Merge pull request #10 from WISVCH/contest-package
Browse files Browse the repository at this point in the history
Rename universities to no longer use a prefix to be compatible with t…
  • Loading branch information
verwoerd authored Oct 25, 2024
2 parents f7a10a4 + 3f38cc1 commit 3bc35d7
Show file tree
Hide file tree
Showing 90 changed files with 292 additions and 224 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 ../..
37 changes: 21 additions & 16 deletions .github/workflows/make_logos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
- run: inkscape --version
- run: pip install svgutils
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- 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 @@ -29,8 +29,8 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v4.1.7
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: logos
path: out
Expand All @@ -39,39 +39,44 @@ 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
uses: actions/checkout@v2
- uses: actions/download-artifact@v4.1.7
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: logos
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
rm contest-package.zip
cd contest-package
zip -r ../contest-package.zip *
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 3bc35d7

Please sign in to comment.