Skip to content

Refactor node_architecture to arch/node and system_architecture to arch/system #404

Refactor node_architecture to arch/node and system_architecture to arch/system

Refactor node_architecture to arch/node and system_architecture to arch/system #404

Workflow file for this run

'on':
pull_request:
types:
- opened
- synchronize
- reopened
- edited
- ready_for_review
env:
CI: true
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INSIDERS_TOKEN: ${{ secrets.INSIDERS_TOKEN }}
PYTHON_VERSION: 3.x
POETRY_VERSION: 1.8.3
# 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.5.37-insiders-4.53.13
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.2.0
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
continue-on-error: true
- name: Check for pre-commit changes
id: git_diff
run: |
git diff --exit-code || echo "NEED=true" >> "$GITHUB_ENV"
- if: env.NEED == 'true'
run: |
git config --global user.name 'Anoma Research'
git config --global user.email 'arts@heliax.dev'
git add .
git commit -m "Fix issues detected by pre-commit"
git push
build-and-deploy:
runs-on: ubuntu-latest
concurrency: ci-${{ github.ref }}
steps:
- uses: actions/checkout@v4.2.0
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.12.0
with:
repo: anoma/juvix
tag: v0.6.6
cache: enable
rename-to: juvix
chmod: 0755
- uses: actions/cache@v4.0.2
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: typecheck Juvix code
run: |
juvix typecheck docs/everything.juvix.md || true
- name: Install Python
uses: actions/setup-python@v5.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- run: echo "cache_id=$(date --utc '+%V')-${{ hashFiles( '**/poetry.lock' )}}-${{ hashFiles( '**/*.py' )}}" >> $GITHUB_ENV
- name: Cache .venv
uses: actions/cache@v4.0.2
with:
path: ./.venv
key: venv-${{ env.cache_id }}
- name: Cache .cache
uses: actions/cache@v4.0.2
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Cache .hooks
uses: actions/cache@v4.0.2
with:
key: hooks-${{ env.cache_id }}
path: .hooks
restore-keys: |
hooks-
- 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 Python dependencies
run: poetry install
- name: Build MkDocs
run: |
poetry run mkdocs build --clean --config-file mkdocs.yml --site-dir $SITE_DIR
env:
SITE_DIR: pr-${{ github.event.pull_request.number }}
SITE_URL: https://anoma.github.io/nspec/pr-${{ github.event.pull_request.number }}
SITE_NAME: Anoma Specification (PR ${{ github.event.pull_request.number }}))
- 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: Build MkDocs with material insiders version
id: material
run: |
pip install git+https://${INSIDERS_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@${INSIDERS_VERSION}
poetry 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://anoma.github.io/nspec/pr-${{ github.event.pull_request.number }}
SITE_NAME: Anoma Specification (PR ${{ github.event.pull_request.number }})
COPYRIGHT: Branch:${{ env.BRANCH_NAME}} - Python:${{ env.PYTHON_VERSION }} - Poetry:${{ env.POETRY_VERSION }} - Material:${{ env.INSIDERS_VERSION }}
- if: steps.material.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.material.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
if: success()
uses: JamesIves/github-pages-deploy-action@v4.6.4
with:
repository-name: anoma/nspec
branch: gh-pages
folder: pr-${{ github.event.pull_request.number }}
target-folder: pr-${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
clean: false
continue-on-error: false
- id: comment-success
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! The preview of this PR will be available at https://anoma.github.io/nspec/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