Fix YAML indentation in verify workflow #447
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: verify | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| workflow_dispatch: | |
| inputs: | |
| ignore_prev_result: | |
| type: boolean | |
| default: false | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| # Allow one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up competitive-verifier | |
| uses: adamant-pwn/actions/setup@patch-1 | |
| with: | |
| cache-pip: true | |
| # Initialize your own environment for resolving. | |
| - name: Use GCC 14.2 | |
| run: | | |
| sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 | |
| g++ --version | |
| - name: oj-resolve | |
| uses: competitive-verifier/actions/oj-resolve@v2 | |
| with: | |
| output-path: verify_files.json | |
| # Specify patterns | |
| exclude: | | |
| images/ | |
| .verify-helper/scripts/ | |
| # If you have config.toml | |
| config: .verify-helper/config.toml | |
| - name: parse-doxygen | |
| 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@v2 | |
| with: | |
| file: verify_files.json | |
| - name: Check bundled | |
| id: test-bundled | |
| run: | | |
| echo "count=$(find .competitive-verifier/bundled/ -type f | wc -l)" >> $GITHUB_OUTPUT | |
| - name: Upload bundled | |
| uses: actions/upload-artifact@v4 | |
| if: steps.test-bundled.outputs.count > 0 | |
| with: | |
| name: Bundled-${{ runner.os }} | |
| path: .competitive-verifier/bundled | |
| retention-days: 1 | |
| verify: | |
| runs-on: ubuntu-latest | |
| needs: [setup] | |
| env: | |
| 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@v4 | |
| with: | |
| fetch-depth: 2147483647 | |
| submodules: recursive | |
| - name: Restore cached results | |
| if: ${{ ! inputs.ignore_prev_result }} | |
| uses: actions/cache/restore@v4 | |
| 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: Download verify_files.json | |
| uses: competitive-verifier/actions/download-verify-artifact@v2 | |
| - name: Set up competitive-verifier | |
| uses: adamant-pwn/actions/setup@patch-1 | |
| with: | |
| cache-pip: true | |
| - name: Use GCC 14.2 | |
| run: | | |
| sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 | |
| g++ --version | |
| - name: Verify | |
| uses: competitive-verifier/actions/verify@v2 | |
| with: | |
| destination: ${{runner.temp}}/result.json | |
| split-size: ${{ env.SPLIT_SIZE }} | |
| split-index: ${{ matrix.index }} | |
| timeout: 1800 | |
| prev-result: ${{ steps.restore-cached-results.outputs.cache-hit && 'merged-result.json' || ''}} | |
| - name: Upload result artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Result-${{ runner.os }}-${{ matrix.index }} | |
| path: ${{runner.temp}}/result.json | |
| retention-days: 1 | |
| docs-and-check: | |
| runs-on: ubuntu-latest | |
| needs: [verify] | |
| outputs: | |
| upload-pages: ${{steps.upload-pages.outcome == 'success'}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2147483647 | |
| submodules: recursive | |
| - name: Download verify_files.json and all artifacts | |
| id: all-artifacts | |
| uses: competitive-verifier/actions/download-verify-artifact@v2 | |
| with: | |
| download-all: true | |
| artifact-root: .artifacts/ | |
| - name: Extract bundled | |
| shell: bash | |
| run: | | |
| rm -rf .competitive-verifier/bundled | |
| if test -d "$SRCDIR"; then | |
| mkdir -p .competitive-verifier/ | |
| mv "$SRCDIR" .competitive-verifier/bundled | |
| else | |
| echo "$SRCDIR does not exist." | |
| fi | |
| env: | |
| SRCDIR: .artifacts/Bundled-${{ runner.os }} | |
| - name: Generate minified versions | |
| shell: bash | |
| run: python3 .verify-helper/scripts/generate_minified.py | |
| - name: Set up competitive-verifier | |
| uses: adamant-pwn/actions/setup@patch-1 | |
| with: | |
| 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@v2 | |
| with: | |
| verify-result: ${{github.workspace}}/merged-result.json | |
| destination: _jekyll | |
| write-summary: true | |
| - name: Inject minified code into documentation | |
| shell: bash | |
| run: python3 .verify-helper/scripts/inject_minified_docs.py | |
| - name: Copy custom Jekyll templates | |
| shell: bash | |
| run: cp -r .verify-helper/docs/static/* _jekyll/ 2>/dev/null || true | |
| - name: Save result | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{github.workspace}}/merged-result.json | |
| key: ${{ runner.os }}-verify-result-${{ github.sha }} | |
| - name: Setup Pages | |
| 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@v3 | |
| with: | |
| path: _site | |
| - name: Commit minified versions | |
| shell: bash | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Clean up any leftover bundled minified directory from previous runs | |
| # (bundled versions should only be in .competitive-verifier/minified-bundled/, not in repo) | |
| rm -rf cp-algo/min-bundled | |
| # Only commit minified source files, not bundled versions | |
| # Bundled versions are generated during CI and used for docs injection, | |
| # but we don't store them in the repo to avoid bloat | |
| if [ -n "$(git status cp-algo/min/ --porcelain)" ]; then | |
| git add cp-algo/min/ | |
| git commit -m "chore: update minified library versions" | |
| git push | |
| else | |
| echo "No changes to minified versions" | |
| fi | |
| - name: Check | |
| uses: competitive-verifier/actions/check@v2 | |
| with: | |
| verify-result: ${{ steps.all-artifacts.outputs.artifacts-root }}/Result-*/result.json | |
| deploy: | |
| if: (success() || failure()) && github.ref == 'refs/heads/main' && needs.docs-and-check.outputs.upload-pages == 'true' | |
| needs: docs-and-check | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |