|
1 | | -name: Upload SDGym Benchmark results |
| 1 | +name: Upload SDGym Benchmark Results |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_run: |
5 | | - workflows: ["Run SDGym Benchmark"] |
6 | | - types: |
7 | | - - completed |
8 | | - workflow_dispatch: |
9 | | - schedule: |
10 | | - - cron: '0 6 * * *' |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + modality: |
| 7 | + description: "Benchmark modality to upload" |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + secrets: |
| 11 | + PYDRIVE_TOKEN: |
| 12 | + required: true |
| 13 | + AWS_ACCESS_KEY_ID: |
| 14 | + required: true |
| 15 | + AWS_SECRET_ACCESS_KEY: |
| 16 | + required: true |
| 17 | + GH_TOKEN: |
| 18 | + required: true |
| 19 | + SLACK_TOKEN: |
| 20 | + required: true |
11 | 21 |
|
12 | 22 | jobs: |
13 | 23 | upload-sdgym-benchmark: |
14 | 24 | runs-on: ubuntu-latest |
15 | 25 |
|
16 | 26 | steps: |
17 | | - - uses: actions/checkout@v4 |
18 | | - with: |
19 | | - fetch-depth: 0 |
20 | | - |
21 | | - - name: Set up latest Python |
22 | | - uses: actions/setup-python@v5 |
23 | | - with: |
24 | | - python-version-file: 'pyproject.toml' |
25 | | - |
26 | | - - name: Install dependencies |
27 | | - run: | |
28 | | - python -m pip install --upgrade pip |
29 | | - python -m pip install --no-cache-dir -e .[dev] |
30 | | - |
31 | | - - name: Upload SDGym Benchmark |
32 | | - env: |
33 | | - PYDRIVE_TOKEN: ${{ secrets.PYDRIVE_TOKEN }} |
34 | | - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
35 | | - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
36 | | - GITHUB_LOCAL_RESULTS_DIR: ${{ runner.temp }}/sdgym-leaderboard-files |
37 | | - run: | |
38 | | - invoke upload-benchmark-results |
39 | | - echo "GITHUB_LOCAL_RESULTS_DIR=$GITHUB_LOCAL_RESULTS_DIR" >> $GITHUB_ENV |
40 | | -
|
41 | | - - name: Prepare files for commit |
42 | | - if: env.SKIP_UPLOAD != 'true' |
43 | | - run: | |
44 | | - mkdir pr-staging |
45 | | - echo "Looking for files in: $GITHUB_LOCAL_RESULTS_DIR" |
46 | | - ls -l "$GITHUB_LOCAL_RESULTS_DIR" |
47 | | - for f in "$GITHUB_LOCAL_RESULTS_DIR"/*; do |
48 | | - if [ -f "$f" ]; then |
49 | | - base=$(basename "$f") |
50 | | - cp "$f" "pr-staging/${base}" |
51 | | - fi |
52 | | - done |
53 | | -
|
54 | | - echo "Files staged for PR:" |
55 | | - ls -l pr-staging |
56 | | -
|
57 | | - - name: Checkout target repo (sdv-dev.github.io) |
58 | | - if: env.SKIP_UPLOAD != 'true' |
59 | | - run: | |
60 | | - git clone https://github.com/sdv-dev/sdv-dev.github.io.git target-repo |
61 | | - cd target-repo |
62 | | - git checkout gatsby-home |
63 | | -
|
64 | | - - name: Copy results and commit |
65 | | - if: env.SKIP_UPLOAD != 'true' |
66 | | - env: |
67 | | - GH_TOKEN: ${{ secrets.GH_TOKEN }} |
68 | | - FOLDER_NAME: ${{ env.FOLDER_NAME }} |
69 | | - run: | |
70 | | - cp pr-staging/* target-repo/assets/sdgym-leaderboard-files/ |
71 | | - cd target-repo |
72 | | - git checkout gatsby-home |
73 | | - git config --local user.name "github-actions[bot]" |
74 | | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
75 | | - git add assets/ |
76 | | - git commit -m "Upload SDGym Benchmark Results ($FOLDER_NAME)" || echo "No changes to commit" |
77 | | - git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/sdv-dev/sdv-dev.github.io.git |
78 | | - git push origin gatsby-home |
79 | | - COMMIT_HASH=$(git rev-parse HEAD) |
80 | | - COMMIT_URL="https://github.com/sdv-dev/sdv-dev.github.io/commit/${COMMIT_HASH}" |
81 | | - echo "Commit URL: $COMMIT_URL" |
82 | | - echo "COMMIT_URL=$COMMIT_URL" >> $GITHUB_ENV |
83 | | -
|
84 | | - - name: Send Slack notification |
85 | | - if: env.SKIP_UPLOAD != 'true' |
86 | | - env: |
87 | | - SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} |
88 | | - run: | |
89 | | - invoke notify-sdgym-benchmark-uploaded \ |
90 | | - --folder-name "$FOLDER_NAME" \ |
91 | | - --commit-url "$COMMIT_URL" |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + - name: Set up latest Python |
| 32 | + uses: actions/setup-python@v5 |
| 33 | + with: |
| 34 | + python-version-file: "pyproject.toml" |
| 35 | + |
| 36 | + - name: Install dependencies |
| 37 | + run: | |
| 38 | + python -m pip install --upgrade pip |
| 39 | + python -m pip install --no-cache-dir -e .[dev] |
| 40 | +
|
| 41 | + - name: Upload SDGym Benchmark |
| 42 | + env: |
| 43 | + PYDRIVE_TOKEN: ${{ secrets.PYDRIVE_TOKEN }} |
| 44 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 45 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 46 | + GITHUB_LOCAL_RESULTS_DIR: ${{ runner.temp }}/sdgym-leaderboard-files |
| 47 | + run: | |
| 48 | + invoke upload-benchmark-results --modality "${{ inputs.modality }}" |
| 49 | + echo "GITHUB_LOCAL_RESULTS_DIR=$GITHUB_LOCAL_RESULTS_DIR" >> $GITHUB_ENV |
| 50 | +
|
| 51 | + - name: Prepare files for commit |
| 52 | + if: env.SKIP_UPLOAD != 'true' |
| 53 | + run: | |
| 54 | + set -euo pipefail |
| 55 | + mkdir -p pr-staging |
| 56 | +
|
| 57 | + echo "Looking for files in: $GITHUB_LOCAL_RESULTS_DIR" |
| 58 | + ls -l "$GITHUB_LOCAL_RESULTS_DIR" || true |
| 59 | +
|
| 60 | + shopt -s nullglob |
| 61 | + for f in "$GITHUB_LOCAL_RESULTS_DIR"/*; do |
| 62 | + [ -f "$f" ] && cp "$f" "pr-staging/$(basename "$f")" |
| 63 | + done |
| 64 | +
|
| 65 | + echo "Files staged for PR:" |
| 66 | + ls -l pr-staging || true |
| 67 | +
|
| 68 | + - name: Checkout target repo (sdv-dev.github.io) |
| 69 | + if: env.SKIP_UPLOAD != 'true' |
| 70 | + run: | |
| 71 | + git clone https://github.com/sdv-dev/sdv-dev.github.io.git target-repo |
| 72 | + cd target-repo |
| 73 | + git checkout gatsby-home |
| 74 | +
|
| 75 | + - name: Copy results and commit |
| 76 | + if: env.SKIP_UPLOAD != 'true' |
| 77 | + env: |
| 78 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
| 79 | + FOLDER_NAME: ${{ env.FOLDER_NAME }} |
| 80 | + run: | |
| 81 | + set -euo pipefail |
| 82 | +
|
| 83 | + cp -f pr-staging/* target-repo/assets/sdgym-leaderboard-files/ || true |
| 84 | + cd target-repo |
| 85 | +
|
| 86 | + git config --local user.name "github-actions[bot]" |
| 87 | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 88 | +
|
| 89 | + git add assets/ |
| 90 | + git commit -m "Upload SDGym Benchmark Results ($FOLDER_NAME) - Modality: ${{ inputs.modality }}" || echo "No changes to commit" |
| 91 | +
|
| 92 | + git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/sdv-dev/sdv-dev.github.io.git" |
| 93 | + git push origin gatsby-home |
| 94 | +
|
| 95 | + COMMIT_HASH=$(git rev-parse HEAD) |
| 96 | + COMMIT_URL="https://github.com/sdv-dev/sdv-dev.github.io/commit/${COMMIT_HASH}" |
| 97 | + echo "COMMIT_URL=$COMMIT_URL" >> $GITHUB_ENV |
| 98 | +
|
| 99 | + - name: Send Slack notification |
| 100 | + if: env.SKIP_UPLOAD != 'true' |
| 101 | + env: |
| 102 | + SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} |
| 103 | + run: | |
| 104 | + invoke notify-sdgym-benchmark-uploaded \ |
| 105 | + --folder-name "$FOLDER_NAME" \ |
| 106 | + --commit-url "$COMMIT_URL" \ |
| 107 | + --modality "${{ inputs.modality }}" |
0 commit comments