Skip to content

EVM PA Documentation Update #1848

EVM PA Documentation Update

EVM PA Documentation Update #1848

Workflow file for this run

name: pull request
on:
pull_request:
types:
- opened
- synchronize
- reopened
env:
CI: true
GH_TOKEN: ${{ github.token }}
# NOTE: insiders version must correspond to the mkdocs-material version in pyproject.toml
# and must be updated in all .yml files in this directory
INSIDERS_VERSION: 9.6.12-insiders-4.53.16
JUVIX_VERSION: v0.6.10
JUST_VERSION: 1.40.0
GIT_COMMITTER_EMAIL: arts@heliax.dev
GIT_COMMITTER_NAME: Anoma Research
SHOW_TODOS_IN_MD: true
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}"
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
repository-projects: write
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Run pre-commit checks
uses: pre-commit/action@v3.0.1
id: pre-commit
with:
extra_args: --all-files --show-diff-on-failure
env:
SKIP: typecheck
continue-on-error: false
- name: Check for pre-commit changes
id: git_diff
run: |
git diff --exit-code
build-basic-without-insiders-and-juvix:
runs-on: ubuntu-latest
concurrency: ci-basic-${{ github.ref }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Install Linux dependencies
run: sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant graphviz
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: extractions/setup-just@v2
with:
just-version: ${{ env.JUST_VERSION }} # optional semver specification, otherwise latest
- run: uv sync
- name: Build basic MkDocs
id: mkdocs-basic
run: |
uv run mkdocs build --clean --config-file mkdocs.yml --site-dir $SITE_DIR
env:
SITE_DIR: pr-${{ github.event.pull_request.number }}
SITE_URL: https://specs.anoma.net/pr-${{ github.event.pull_request.number }}/
SITE_VERSION: (PR ${{ github.event.pull_request.number }})
PROCESS_JUVIX: false
TIMELIMIT: 100
- name: The build failed comment
if: failure()
run: |
gh pr -R anoma/nspec comment ${{ github.event.pull_request.number }} --edit-last --body "The build failed. Please check the logs."
- name: Deploy basic MkDocs
if: success()
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.PAGES_TOKEN }}
repository-name: anoma/specs.anoma.net
branch: main
folder: pr-${{ github.event.pull_request.number }}
target-folder: pr-${{ github.event.pull_request.number }}/basic
clean: false
continue-on-error: false
- id: comment-success-basic
if: success()
continue-on-error: true
run: gh pr -R anoma/nspec comment ${{ github.event.pull_request.number }} --edit-last --body "$MSG"
env:
MSG: "Success! Preview of basic version available at https://specs.anoma.net/pr-${{ github.event.pull_request.number }}/basic/."
build-and-deploy-with-insiders-and-juvix:
runs-on: ubuntu-latest
concurrency: ci-${{ github.ref }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- run: |
git config --global user.name 'Anoma Research'
git config --global user.email 'arts@heliax.dev'
- name: comment on PR
run: gh $GH_FLAGS --edit-last --body "$MSG" || gh $GH_FLAGS --body "$MSG"
continue-on-error: true
env:
MSG: "The build is in progress. Please wait for the preview link."
GH_FLAGS: pr -R anoma/nspec comment ${{ github.event.pull_request.number }}
- name: Install the right Juvix for the Specs
uses: jaxxstorm/action-install-gh-release@v1
with:
repo: anoma/juvix
tag: ${{ env.JUVIX_VERSION }}
cache: enable
rename-to: juvix
chmod: 0755
- uses: actions/cache@v4
with:
key: juvix-cache-${{ hashFiles('**/*.juvix.md') }}-${{ hashFiles('**/*.juvix') }}
path: .juvix-build
restore-keys: |
juvix-cache-
- id: juvix-version
name: See the dev version in the documentation
run: |
juvix --version
- name: Install Linux dependencies
run: sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant graphviz
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: extractions/setup-just@v2
with:
just-version: 1.40.0 # optional semver specification, otherwise latest
- run: just setup-repo
- name: get the last commit short hash
id: commit
run: echo "::set-output name=commit::$(git rev-parse --short HEAD)"
- name: get the last commit in main
id: main-commit
run: echo "::set-output name=commit::$(git rev-parse --short main)"
- name: Install material insiders version
run: uv add git+https://${{ secrets.INSIDERS_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git@${INSIDERS_VERSION}
- name: Build MkDocs with material insiders version
id: mkdocs-insiders
run: |
uv run mkdocs build --clean --config-file mkdocs.insiders.yml --site-dir $SITE_DIR
env:
SITE_DIR: pr-${{ github.event.pull_request.number }}
SITE_URL: https://specs.anoma.net/pr-${{ github.event.pull_request.number }}/
SITE_VERSION: (PR${{ github.event.pull_request.number }} - ${{env.BRANCH_NAME }}-${{ steps.commit.outputs.commit }})
COPYRIGHT: Powered by Mkdocs, Poetry ${{ env.POETRY_VERSION }}, Material ${{ env.INSIDERS_VERSION }} and Juvix ${{ env.JUVIX_VERSION }}
REMOVE_CACHE: true
PROCESS_JUVIX: true
TIMELIMIT: 100
- if: steps.mkdocs-insiders.outcome == 'failure'
run: |
gh pr -R anoma/nspec comment ${{ github.event.pull_request.number }} --edit-last --body "The build failed with MkDocs Insiders. Please check the logs."
- if: steps.mkdocs-insiders.outcome == 'success'
run: |
gh pr -R anoma/nspec comment ${{ github.event.pull_request.number }} --edit-last --body "Builds using material and material-insiders theme succeed. We are now deploying the preview"
continue-on-error: true
- name: Deploy MkDocs with insiders theme
if: success()
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.PAGES_TOKEN }}
repository-name: anoma/specs.anoma.net
branch: main
folder: pr-${{ github.event.pull_request.number }}
target-folder: pr-${{ github.event.pull_request.number }}
clean: false
continue-on-error: false
- id: comment-success-insiders
if: success()
continue-on-error: true
run: gh pr -R anoma/nspec comment ${{ github.event.pull_request.number }} --edit-last --body "$MSG"
env:
MSG: "Success! Preview available at https://specs.anoma.net/pr-${{ github.event.pull_request.number }}/."
- name: typecheck
continue-on-error: true
run: |
juvix --log-level error typecheck docs/everything.juvix.md
- if: steps.typecheck.outcome == 'failure'
run: |
gh pr -R anoma/nspec comment ${{ github.event.pull_request.number }} --edit-last --body "$MSG"
env:
MSG: "The typecheck failed. Please check the logs. However, the preview is available at https://specs.anoma.net/pr-${{ github.event.pull_request.number }}/."
- name: Failed preview build comment
if: failure()
run: |
gh pr -R anoma/nspec comment ${{ github.event.pull_request.number }} --edit-last --body "The preview of this PR failed to build. Check the logs."
continue-on-error: true