Skip to content

Update CHANGES.md

Update CHANGES.md #148

Workflow file for this run

name: test & publish
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
- 'CHANGES.md'
- 'contributions/*'
- '.github/**/*'
- 'experiments/**/*'
pull_request_target:
workflow_dispatch:
schedule:
- cron: '30 4 * * MON'
env:
DEBIAN_FRONTEND: noninteractive
DOCKER_DEV_IMAGE: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.draft == true }}
jobs:
spacecheck:
name: Style check (Tabs and spaces)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Check for tabs and trailing spaces
run: |
! grep -n -P '\t|\s+$' markdown.dtx
shellcheck:
name: Style check (Bash)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Run ShellCheck
uses: ludeeus/[email protected]
env:
SHELLCHECK_OPTS: -e SC1091
luacheck:
name: Style check (Lua)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Install additional packages
run: |
set -ex
sudo apt -qy update
sudo apt -qy install --no-install-recommends git latexmk lua-check make texlive-xetex
- name: Extract Lua scripts
run: make base
- name: Run luacheck
run: luacheck *.lua
markdownlint:
name: Style check (Markdown)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Install additional packages
run: |
set -ex
sudo apt -qy update
sudo apt -qy install --no-install-recommends git latexmk lua-check make texlive-xetex
- name: Extract user manual
run: make markdown-transcluded.md
- name: Run MarkdownLint
uses: nosborn/[email protected]
with:
files: .
config_file: .markdownlint.yaml
flake8:
name: Style check (Python)
runs-on: ubuntu-latest
container:
image: python:3.10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Install additional packages
run: |
set -ex
pip install -U pip wheel setuptools
pip install flake8
- name: Run Flake8
run: flake8 tests/test.py
pytype:
name: Type check (Python)
needs:
- flake8
runs-on: ubuntu-latest
container:
image: python:3.10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Install additional packages
run: |
set -ex
pip install -U pip wheel setuptools
pip install -r tests/requirements.txt
pip install pytype libcst==1.2.0
- name: Run Pytype
run: pytype tests/test.py
build-docker-image:
name: Build Docker image
needs:
- spacecheck
- shellcheck
- luacheck
- markdownlint
- pytype
strategy:
fail-fast: true
matrix:
texlive:
- TL2022-historic
- TL2023-historic
- latest
outputs:
TL2022-historic: ${{ steps.temporary-tags.outputs.TL2022-historic }}
TL2023-historic: ${{ steps.temporary-tags.outputs.TL2023-historic }}
latest: ${{ steps.temporary-tags.outputs.latest }}
runs-on: ubuntu-latest
permissions:
packages: write
env:
DOCKER_TEXLIVE_TAG: ${{ matrix.texlive }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Build Docker image
run: make docker-image
- name: Login to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Docker image with a temporary tag
run: make docker-push-temporary-tag
- name: Store the temporary tag
id: temporary-tags
run: |
set -ex
TEMPORARY_TAG="$(make docker-print-temporary-tag)"
echo "${{ matrix.texlive }}=$TEMPORARY_TAG" >> $GITHUB_OUTPUT
test:
name: Test Docker image
needs:
- build-docker-image
strategy:
fail-fast: true
matrix:
texlive:
- TL2022-historic
- TL2023-historic
- latest
runs-on: self-hosted
container:
image: ghcr.io/witiko/markdown:${{ needs.build-docker-image.outputs[matrix.texlive] }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: Set safe Git directory
# This should have been done by the previous step.
# See also: <https://github.com/actions/checkout/issues/915>.
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Test Lua command-line interface
run: |
set -ex
RESULT="$(printf '%s\n' 'Hello *Markdown*! $a_x + b_x = c_x$' | markdown-cli hybrid=true underscores=false)"
test "$RESULT" = '\markdownRendererDocumentBegin
Hello \markdownRendererEmphasis{Markdown}! $a_x + b_x = c_x$\markdownRendererDocumentEnd'
- name: Run unit tests
if: matrix.texlive == 'latest' || github.event_name != 'pull_request_target' || github.event.pull_request.draft == false
run: make FAIL_FAST=${{ github.event_name == 'pull_request_target' }} test
publish-docker-image:
name: Publish Docker image
needs:
- build-docker-image
- test
strategy:
fail-fast: true
matrix:
texlive:
- TL2022-historic
- TL2023-historic
- latest
runs-on: ubuntu-latest
if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main'
env:
DOCKER_TEXLIVE_TAG: ${{ matrix.texlive }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Publish Docker image
run: make docker-push-release-tag
publish-artefacts:
name: Publish artefacts and create a prerelease
needs:
- build-docker-image
- test
strategy:
fail-fast: true
matrix:
texlive:
- TL2022-historic
- TL2023-historic
- latest
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: ghcr.io/witiko/markdown:${{ needs.build-docker-image.outputs[matrix.texlive] }}
if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build distribution archives
if: matrix.texlive == 'latest'
run: |
set -ex
chown -R root:root .
make dist gh-pages
- name: Upload artifact markdown.tds.zip
if: matrix.texlive == 'latest'
uses: actions/upload-artifact@v4
with:
name: markdown.tds.zip
path: markdown.tds.zip
- name: Upload artifact markdown.ctan.zip
if: matrix.texlive == 'latest'
uses: actions/upload-artifact@v4
with:
name: markdown.ctan.zip
path: markdown.ctan.zip
- name: Upload artifact markdown.zip
if: matrix.texlive == 'latest'
uses: actions/upload-artifact@v4
with:
name: markdown.zip
path: markdown.zip
- name: Upload artifact markdown.pdf
if: matrix.texlive == 'latest'
uses: actions/upload-artifact@v4
with:
name: markdown.pdf
path: markdown.pdf
- name: Publish user manual
if: matrix.texlive == 'latest'
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: gh-pages
build_dir: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create a prerelease
if: matrix.texlive == 'latest'
uses: marvinpinto/action-automatic-releases@latest
with:
title: The latest version
automatic_release_tag: latest
prerelease: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
files: |
markdown.tds.zip
markdown.ctan.zip
markdown.zip
markdown.pdf
automerge:
name: Automatically merge pull request
needs:
- test
runs-on: ubuntu-latest
permissions:
contents: write
if: github.event_name == 'pull_request_target' && github.event.pull_request.draft == false
steps:
- name: Automatically merge pull request
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"