Skip to content

fix: do not only lockup the default upload_folder #57

fix: do not only lockup the default upload_folder

fix: do not only lockup the default upload_folder #57

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
tests:
runs-on: ubuntu-latest
env:
NAME: ctfer
PASSWORD: ctfer
services:
# chall-manager:
# image: registry.dev1.ctfer-io.lab/ctferio/chall-manager:ci
# ports:
# - 9090:9090
# - 8081:8081
# credentials:
# username: ${{ secrets.registry_user }}
# password: ${{ secrets.registry_pass }}
chall-manager:
image: nicofgrx/chall-manager:ci
ports:
- 9090:9090
- 8081:8081
credentials:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
mariadb:
image: mariadb:10.7.8
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: ctfer
ctfd:
image: ctfd/ctfd:3.7.2@sha256:bb8077128668007e5130d37dbcd500b933cd449a4ae58fc327147f3811fbff7b
ports:
- 8000:8000
options: --mount type=bind,source=${{ github.workspace }},target=/opt/CTFd/CTFd/plugins/ctfd-chall-manager
env:
DATABASE_URL: mysql+pymysql://root:ctfer@mariadb/ctfd
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Wait for CTFd server
run: |
max_attempts=60
base_url="http://localhost:8000"
for ((i=0; i<$max_attempts; i++)); do
if curl --head --fail --silent --show-error "$base_url" >/dev/null; then
echo "Server is up and running!"
break
else
echo "Waiting for the server to respond... (attempt $((i+1)))"
sleep 5
fi
done
if [ $i -eq $max_attempts ]; then
echo "Server did not respond within the allotted time. Exiting..."
exit 1
fi
- name: Wait for Chall-Manager server
run: |
max_attempts=60
base_url="http://localhost:9090/api/v1/challenge"
for ((i=0; i<$max_attempts; i++)); do
if curl --fail --silent --show-error "$base_url" >/dev/null; then
echo "Server is up and running!"
break
else
echo "Waiting for the server to respond... (attempt $((i+1)))"
sleep 5
fi
done
if [ $i -eq $max_attempts ]; then
echo "Server did not respond within the allotted time. Exiting..."
exit 1
fi
- name: Setup CTFd
uses: ctfer-io/ctfd-setup@6184bab99f91c895dae9172ba30bce87ef10a120 # v1.1.9
with:
url: 'http://ctfd:8000'
appearance_name: CTFer.io
appearance_description: CTFer.io plugin tests
mode: users # TODO add tests with teams
admin_name: ${{ env.NAME }}
admin_email: [email protected]
admin_password: ${{ env.PASSWORD }}
- name: Generate demo-deploy.zip for tests
run: |
cd hack
zip -r ${{ github.workspace }}/demo-deploy.zip deploy
- name: tests with cypress
uses: cypress-io/github-action@8d3918616d8ac34caa2b49afc8b408b6a872a6f5 # v6.7.1
env:
CYPRESS_CTFD_NAME: ${{ env.NAME }}
CYPRESS_CTFD_PASSWORD: ${{ env.PASSWORD }}
CYPRESS_CTFD_URL: "http://localhost:8000"
CYPRESS_SCENARIO_PATH: "${{ github.workspace }}/demo-deploy.zip"
CYPRESS_PLUGIN_SETTINGS_CM_API_URL: "http://chall-manager:9090/api/v1"
CYPRESS_PLUGIN_SETTINGS_CM_MANA_TOTAL: "50"
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots