Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 56 additions & 9 deletions .github/workflows/validate-and-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,55 @@ name: Validate and Process EvalAI Challenge
on:
push:
branches:
- challenge
- 'challenge'
- 'challenge-*-*'
pull_request:
types: [opened, synchronize, reopened, edited]

permissions:
contents: read
issues: write

jobs:
detect-and-validate-challenge-branch:
runs-on: ubuntu-latest
outputs:
is_challenge_branch: ${{ steps.branch-check.outputs.is_challenge_branch }}
challenge_branch: ${{ steps.branch-check.outputs.challenge_branch }}
steps:
- name: Detect and validate challenge branch
id: branch-check
run: |
# Get the actual branch name
if [ "${{ github.event_name }}" == "pull_request" ]; then
BRANCH="${{ github.head_ref }}"
else
BRANCH="${{ github.ref_name }}"
fi

echo "🔍 Analyzing branch: $BRANCH"
echo "challenge_branch=$BRANCH" >> $GITHUB_OUTPUT

# Check if this is a challenge branch (challenge or challenge-YYYY-version)
if [[ "$BRANCH" =~ ^challenge(-[0-9]{4}-.*)?$ ]]; then
echo "is_challenge_branch=true" >> $GITHUB_OUTPUT
echo "✅ Valid challenge branch detected: $BRANCH"

# Extract branch suffix for versioning
if [[ "$BRANCH" =~ ^challenge-([0-9]{4}-.+)$ ]]; then
SUFFIX="${BASH_REMATCH[1]}"
echo "branch_suffix=$SUFFIX" >> $GITHUB_OUTPUT
echo "📋 Branch version: $SUFFIX"
else
echo "branch_suffix=main" >> $GITHUB_OUTPUT
echo "📋 Main challenge branch (no suffix)"
fi
else
echo "is_challenge_branch=false" >> $GITHUB_OUTPUT
echo "ℹ️ Not a challenge branch: $BRANCH"
echo "⏭️ Challenge processing will be skipped (valid patterns: 'challenge' or 'challenge-YYYY-version')"
fi

validate-host-config:
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -120,9 +162,10 @@ jobs:


process-evalai-challenge:
needs: [validate-host-config, check-self-hosted-requirements]
needs: [detect-and-validate-challenge-branch, validate-host-config, check-self-hosted-requirements]
if: |
always() &&
needs.detect-and-validate-challenge-branch.outputs.is_challenge_branch == 'true' &&
needs.validate-host-config.outputs.is_valid == 'true' &&
(needs.check-self-hosted-requirements.result == 'success' || needs.check-self-hosted-requirements.result == 'skipped')
runs-on: ${{ needs.validate-host-config.outputs.requires_self_hosted == 'true' && 'self-hosted' || 'ubuntu-latest' }}
Expand All @@ -131,7 +174,7 @@ jobs:
- name: Checkout challenge branch
uses: actions/checkout@v3
with:
ref: challenge
ref: ${{ needs.detect-and-validate-challenge-branch.outputs.challenge_branch }}

- name: Set up Python (GitHub-hosted only)
if: needs.validate-host-config.outputs.requires_self_hosted != 'true'
Expand Down Expand Up @@ -183,10 +226,11 @@ jobs:
run: |
echo "🔍 VALIDATING CHALLENGE CONFIGURATION"
echo "====================================="
python3 github/challenge_processing_script.py
python3 github/challenge_processing_script.py ${{ needs.detect-and-validate-challenge-branch.outputs.challenge_branch }}
env:
IS_VALIDATION: 'True'
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}

- name: Validate challenge configuration (Self-hosted with Docker)
Expand All @@ -202,25 +246,27 @@ jobs:
-e GITHUB_CONTEXT='${{ toJson(github) }}' \
-e GITHUB_REPOSITORY='${{ github.repository }}' \
-e GITHUB_AUTH_TOKEN='${{ secrets.AUTH_TOKEN }}' \
-e GIT_BRANCH='${{ needs.detect-and-validate-challenge-branch.outputs.challenge_branch }}' \
python:3.9-slim \
bash -c "
pip install -r github/requirements.txt &&
python3 github/challenge_processing_script.py
python3 github/challenge_processing_script.py \$GIT_BRANCH
"

- name: Create or update challenge (GitHub-hosted)
if: success() && needs.validate-host-config.outputs.requires_self_hosted != 'true'
if: github.event_name == 'push' && success() && needs.validate-host-config.outputs.requires_self_hosted != 'true'
run: |
echo "🚀 CREATING/UPDATING CHALLENGE"
echo "=============================="
python3 github/challenge_processing_script.py
python3 github/challenge_processing_script.py ${{ needs.detect-and-validate-challenge-branch.outputs.challenge_branch }}
env:
IS_VALIDATION: 'False'
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}

- name: Create or update challenge (Self-hosted with Docker)
if: success() && needs.validate-host-config.outputs.requires_self_hosted == 'true'
if: github.event_name == 'push' && success() && needs.validate-host-config.outputs.requires_self_hosted == 'true'
run: |
echo "🚀 CREATING/UPDATING CHALLENGE (Docker)"
echo "========================================"
Expand All @@ -232,8 +278,9 @@ jobs:
-e GITHUB_CONTEXT='${{ toJson(github) }}' \
-e GITHUB_REPOSITORY='${{ github.repository }}' \
-e GITHUB_AUTH_TOKEN='${{ secrets.AUTH_TOKEN }}' \
-e GIT_BRANCH='${{ needs.detect-and-validate-challenge-branch.outputs.challenge_branch }}' \
python:3.9-slim \
bash -c "
pip install -r github/requirements.txt &&
python3 github/challenge_processing_script.py
python3 github/challenge_processing_script.py \$GIT_BRANCH
"
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,22 @@ If you are looking for a simple challenge configuration that you can replicate t

5. Create a branch with name `challenge` in the forked repository from the `master` branch.
<span style="color:purple">Note: Only changes in `challenge` branch will be synchronized with challenge on EvalAI.</span>
You may maintain multiple versions by using additional branches whose names start with `challenge-` (e.g. `challenge-2024`, `challenge-v2`).
<span style="color:purple">Note: The CI pipeline only runs for branches that match the pattern `challenge` or `challenge-*`. Any other branch name will be ignored.</span>

If you trigger the processing script manually and do **not** pass a branch argument, it will assume the branch name is `challenge` by default.

6. Add `evalai_user_auth_token` and `host_team_pk` in `github/host_config.json`.

7. Read [EvalAI challenge creation documentation](https://evalai.readthedocs.io/en/latest/configuration.html) to know more about how you want to structure your challenge. Once you are ready, start making changes in the yaml file, HTML templates, evaluation script according to your need.

8. Commit the changes and push the `challenge` branch in the repository and wait for the build to complete. View the [logs of your build](https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/using-workflow-run-logs#viewing-logs-to-diagnose-failures).
8. Commit the changes and push the relevant `challenge*` branch to the repository and wait for the build to complete. View the [logs of your build](https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/using-workflow-run-logs#viewing-logs-to-diagnose-failures).

9. If challenge config contains errors then a `issue` will be opened automatically in the repository with the errors otherwise the challenge will be created on EvalAI.
9. If the challenge config contains errors, a GitHub **Issue** will be opened automatically in the repository with the error details; otherwise the challenge will be created on EvalAI.

10. Go to [Hosted Challenges](https://eval.ai/web/hosted-challenges) to view your challenge. The challenge will be publicly available once EvalAI admin approves the challenge.

11. To update the challenge on EvalAI, make changes in the repository and push on `challenge` branch and wait for the build to complete.
11. To update the challenge on EvalAI, make changes in the repository and push to the corresponding `challenge*` branch and wait for the build to complete.

## Add custom dependencies for evaluation (Optional)
To add custom dependency packages in the evaluation script, refer to [this guide](./evaluation_script/dependency-installation.md).
Expand Down
Loading
Loading