Skip to content

Commit

Permalink
update verify.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
idat50me committed May 5, 2024
1 parent 9994654 commit b225ade
Showing 1 changed file with 55 additions and 32 deletions.
87 changes: 55 additions & 32 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
branches:
- "master"
workflow_dispatch:
inputs:
ignore_prev_result:
type: boolean
default: false

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
Expand All @@ -22,17 +26,16 @@ jobs:
outputs:
dropbox_token: ${{steps.set_dropbox_token.outputs.dropbox_token}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up competitive-verifier
uses: competitive-verifier/actions/setup@v1
uses: competitive-verifier/actions/setup@v2
with:
python-version: "3.9"
cache-pip: true

# Initialize your own environment for resolving.
- name: oj-resolve
uses: competitive-verifier/actions/oj-resolve@v1
uses: competitive-verifier/actions/oj-resolve@v2
with:
output-path: verify_files.json
# Specify patterns
Expand All @@ -41,12 +44,12 @@ jobs:
# If you have config.toml
# config: .verify-helper/config.toml
- name: parse-doxygen
uses: competitive-verifier/actions/parse-doxygen@v1
uses: competitive-verifier/actions/parse-doxygen@v2
with:
verify-files: verify_files.json

- name: Upload verify_files.json
uses: competitive-verifier/actions/upload-verify-artifact@v1
uses: competitive-verifier/actions/upload-verify-artifact@v2
with:
file: verify_files.json

Expand All @@ -55,7 +58,7 @@ jobs:
run: |
echo "count=$(find .competitive-verifier/bundled/ -type f | wc -l)" >> $GITHUB_OUTPUT
- name: Upload bundled
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: steps.test-bundled.outputs.count > 0
with:
name: Bundled-${{ runner.os }}
Expand Down Expand Up @@ -84,44 +87,55 @@ jobs:
runs-on: ubuntu-latest
needs: [setup]
env:
SPLIT_SIZE: 20
SPLIT_SIZE: "20"
strategy:
matrix:
# prettier-ignore
index:
["00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 2147483647

- name: Restore cached results
if: ${{ ! inputs.ignore_prev_result }}
uses: actions/cache/restore@v3
id: restore-cached-results
with:
path: ${{github.workspace}}/merged-result.json
key: ${{ runner.os }}-verify-result-${{ github.sha }}
restore-keys: |
${{ runner.os }}-verify-result-
- name: Recieve dropbox token
run: |
DROPBOX_TOKEN=$(echo "${{needs.setup.outputs.dropbox_token}}" | openssl enc -aes256 -d -pbkdf2 -base64 -A -k '${{secrets.AES256_KEY}}')
echo "::add-mask::$DROPBOX_TOKEN"
echo "DROPBOX_TOKEN=$DROPBOX_TOKEN" >> $GITHUB_ENV
- name: Download verify_files.json
uses: competitive-verifier/actions/download-verify-artifact@v1
uses: competitive-verifier/actions/download-verify-artifact@v2

- name: Set up competitive-verifier
uses: competitive-verifier/actions/setup@v1
uses: competitive-verifier/actions/setup@v2
with:
python-version: "3.9"
cache-pip: true

# Initialize your own environment for verification.
- name: Verify
uses: competitive-verifier/actions/verify@v1
uses: competitive-verifier/actions/verify@v2
with:
destination: ${{runner.temp}}/result.json
split-size: ${{ env.SPLIT_SIZE }}
split-index: ${{ matrix.index }}
timeout: 1200
timeout: 1800
prev-result: ${{ steps.restore-cached-results.outputs.cache-hit && 'merged-result.json' || ''}}
env:
YUKICODER_TOKEN: ${{secrets.YUKICODER_TOKEN}}

- name: Upload result artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Result-${{ runner.os }}-${{ matrix.index }}
path: ${{runner.temp}}/result.json
Expand All @@ -133,17 +147,17 @@ jobs:
outputs:
upload-pages: ${{steps.upload-pages.outcome == 'success'}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

fetch-depth: 2147483647
- name: Download verify_files.json and all artifacts
id: all-artifacts
uses: competitive-verifier/actions/download-verify-artifact@v1
uses: competitive-verifier/actions/download-verify-artifact@v2
with:
download-all: true
artifact-root: .artifacts/

- name: Extract bundled
shell: bash
run: |
Expand All @@ -152,43 +166,52 @@ jobs:
mkdir -p .competitive-verifier/
mv "$SRCDIR" .competitive-verifier/bundled
else
echo "$SRCDIR is not exists."
echo "$SRCDIR does not exist."
fi
env:
SRCDIR: .artifacts/Bundled-${{ runner.os }}

- name: Set up competitive-verifier
uses: competitive-verifier/actions/setup@v1
uses: competitive-verifier/actions/setup@v2
with:
python-version: "3.9"
cache-pip: true

- name: Merge results
uses: competitive-verifier/actions/merge-result@v2
with:
result-files: ${{ steps.all-artifacts.outputs.artifacts-root }}/Result-*/result.json
output-path: ${{github.workspace}}/merged-result.json
- name: Docs
uses: competitive-verifier/actions/docs@v1
uses: competitive-verifier/actions/docs@v2
with:
verify-result: ${{ steps.all-artifacts.outputs.artifacts-root }}/Result-*/result.json
verify-result: ${{github.workspace}}/merged-result.json
destination: _jekyll
write-summary: true
- name: Save result
uses: actions/cache/save@v3
with:
path: ${{github.workspace}}/merged-result.json
key: ${{ runner.os }}-verify-result-${{ github.sha }}

- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: _jekyll
destination: _site
- name: Upload artifact
id: upload-pages
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: _site

- name: Check
uses: competitive-verifier/actions/check@v1
uses: competitive-verifier/actions/check@v2
with:
verify-result: ${{ steps.all-artifacts.outputs.artifacts-root }}/Result-*/result.json
deploy:
if: always() && github.ref == 'refs/heads/master'
if: (success() || failure()) && github.ref == 'refs/heads/master' && needs.docs-and-check.outputs.upload-pages == 'true'
needs: docs-and-check
environment:
name: github-pages
Expand All @@ -197,4 +220,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v3

0 comments on commit b225ade

Please sign in to comment.