Skip to content

Commit 8891697

Browse files
Didayoloihsaan-ullahnicomybbearce
authored
Merge pull request #1685 from codalab/develop
* participants and submissions count fileds added to competition modal, use these counts in the competition detail page, public competitions page, home page popular competitions * unused import removed - flake8 * Remove useless comments * Update example_submission.py While I was trying to use the robot submission, I had to add the file_size in the payload in order to achieve a robot submission * tests added for submissions and participants counts * commented the failing chahub tests (to be removed later) * default participants count set to 1, script added to update counts for all competitions * tests updated for the default participants count * submission count fixed for multi-task competitions, updated delete multiple function to trigger modal's delete method, updated count script to count only parent submissions * Optimization `PR#1` - Featured competitions (#1678) * Featured field added in competition * spelling fixed in comment * Merge migrations from PR1 and PR2 --------- Co-authored-by: Adrien Pavão <[email protected]> * twisted_certifi_requests (#1672) * twisted_certifi_requests * poetry update --------- Co-authored-by: Ihsan Ullah <[email protected]> Co-authored-by: Nicolas Homberg <[email protected]> Co-authored-by: Benjamin Bearce <[email protected]>
2 parents 7b907be + d4ad8a1 commit 8891697

24 files changed

+949
-595
lines changed
+29-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Update version.json and create PR
22

3+
# Trigger the github action when a new release is published
34
on:
45
release:
56
types: [published]
@@ -9,50 +10,62 @@ jobs:
910
runs-on: ubuntu-latest
1011

1112
steps:
13+
14+
# Step 1: Checkout repository
1215
- name: Checkout repository
1316
uses: actions/checkout@v3
1417

18+
# Step 2: Get latest release version information
1519
- name: Get release information
1620
id: get_release
1721
run: |
1822
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
1923
echo "$response" | jq '.tag_name, .name, .published_at, .body, .html_url' | tee /tmp/release_info
20-
echo "::set-output name=tag_name::$(echo "$response" | jq -r .tag_name)"
21-
echo "::set-output name=name::$(echo "$response" | jq -r .name)"
22-
echo "::set-output name=published_at::$(echo "$response" | jq -r .published_at)"
23-
echo "::set-output name=body::$(echo "$response" | jq -r .body)"
24-
echo "::set-output name=html_url::$(echo "$response" | jq -r .html_url)"
25-
24+
echo "tag_name=$(echo "$response" | jq -r .tag_name)" >> $GITHUB_ENV
25+
echo "name=$(echo "$response" | jq -r .name)" >> $GITHUB_ENV
26+
echo "published_at=$(echo "$response" | jq -r .published_at)" >> $GITHUB_ENV
27+
echo "body=$(echo "$response" | jq -r .body)" >> $GITHUB_ENV
28+
echo "html_url=$(echo "$response" | jq -r .html_url)" >> $GITHUB_ENV
2629
30+
# Step 3: Update version.json file with latest information
2731
- name: Update version.json
2832
run: |
2933
echo '{
30-
"tag_name": "${{ steps.get_release.outputs.tag_name }}",
31-
"release_name": "${{ steps.get_release.outputs.name }}",
32-
"published_at": "${{ steps.get_release.outputs.published_at }}",
33-
"body": "${{ steps.get_release.outputs.body }}"
34-
"html_url": "${{ steps.get_release.outputs.html_url }}"
34+
"tag_name": "${{ env.tag_name }}",
35+
"release_name": "${{ env.name }}",
36+
"published_at": "${{ env.published_at }}",
37+
"body": "${{ env.body }}",
38+
"html_url": "${{ env.html_url }}"
3539
}' > version.json
3640
41+
# Step 4: Configure a user to create a branch and then push changes
42+
- name: Configure Git user
43+
run: |
44+
git config --global user.name "GitHub Actions"
45+
git config --global user.email "[email protected]"
46+
47+
# Step 5: Create a new branch for version updates
3748
- name: Create new branch
3849
run: |
39-
git checkout -b update-version-${{ steps.get_release.outputs.tag_name }}
50+
git checkout -b update-version-${{ env.tag_name }}
4051
git add version.json
41-
git commit -m "Update version.json for release ${{ steps.get_release.outputs.tag_name }}"
52+
git commit -m "Update version.json for release ${{ env.tag_name }}"
4253
54+
# Step 6: Push branch
4355
- name: Push branch
4456
run: |
45-
git push origin update-version-${{ steps.get_release.outputs.tag_name }}
57+
git push origin update-version-${{ env.tag_name }}
4658
env:
4759
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4860

61+
# Step 7: Create a pull request from the pushed branch
4962
- name: Create Pull Request
5063
run: |
5164
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" \
5265
https://api.github.com/repos/${{ github.repository }}/pulls \
5366
-d '{
54-
"title": "Update version.json for release ${{ steps.get_release.outputs.tag_name }}",
67+
"title": "Update version.json for release ${{ env.tag_name }}",
5568
"body": "This PR updates version.json with the latest release information.",
56-
"head": "update-version-${{ steps.get_release.outputs.tag_name }}",
69+
"head": "update-version-${{ env.tag_name }}",
5770
"base": "develop"
5871
}'

compute_worker/poetry.lock

+141-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compute_worker/pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ name = "compute-worker"
33
version = "0.1.0"
44
description = ""
55
authors = ["codalab"]
6-
readme = "README.md"
76

87
[tool.poetry.dependencies]
98
python = "^3.9"
109
celery = "4.4.0"
11-
requests = "2.20.0"
10+
requests = "^2.20.0"
1211
watchdog = "2.1.1"
1312
argh = "0.26.2"
1413
websockets = "8.1"

docs/example_scripts/example_submission.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# ----------------------------------------------------------------------------
4242
from urllib.parse import urljoin # noqa: E402
4343
import requests # noqa: E402,E261 # Ignore E261 to line up these noqa
44-
44+
import os
4545

4646
# Check someone updated PHASE_ID argument!
4747
assert PHASE_ID, "PHASE_ID must be set at the top of this script"
@@ -68,11 +68,16 @@
6868
print(f"Failed to create submission: {resp.json()['reason']}")
6969
exit(-2)
7070

71+
72+
73+
file_size = os.path.getsize(SUBMISSION_ZIP_PATH)
74+
7175
# Create + Upload our dataset
7276
datasets_url = urljoin(CODALAB_URL, '/api/datasets/')
7377
datasets_payload = {
7478
"type": "submission",
7579
"request_sassy_file_name": "submission.zip",
80+
"file_size": file_size,
7681
}
7782
resp = requests.post(datasets_url, datasets_payload, headers=headers)
7883
if resp.status_code != 201:

0 commit comments

Comments
 (0)