Skip to content

Update setup-node (#48) #24

Update setup-node (#48)

Update setup-node (#48) #24

Workflow file for this run

name: Check and Build
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
release:
types: [released]
permissions: read-all
jobs:
format:
name: Check formatting
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python: ['3.11', '3.12']
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Check formatting
run: make format
lint:
name: Check for erroneous constructs
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python: ['3.11', '3.12']
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Check for erroneous constructs
run: make lint
links:
name: Check Markdown links
runs-on: ubuntu-20.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Check Markdown links
run: |
npm install -g markdown-link-check
make links
test:
name: Run tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python: ['3.11', '3.12']
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Run tests
run: make test
build:
name: Make pip packages
runs-on: ubuntu-20.04
needs: [format, lint, test]
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Building toltecmk
run: make build
- uses: actions/upload-artifact@v4
with:
name: pip
path: dist/*
if-no-files-found: error
standalone:
name: Make Standalone
runs-on: ubuntu-20.04
needs: [format, lint, test]
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Building toltecmk
run: make standalone
- name: Sanity check
run: ./toltecmk --help
- uses: actions/upload-artifact@v4
with:
name: toltecmk
path: toltecmk
if-no-files-found: error
publish:
name: Publish to PyPi
runs-on: ubuntu-20.04
needs: [build, links]
if: github.repository == 'toltec-dev/build' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/toltecmk
steps:
- name: Download pip packages
id: download
uses: actions/download-artifact@v4
with:
name: pip
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ${{ steps.download.outputs.download-path }}
release:
name: Add ${{ matrix.artifact }} to release
if: github.repository == 'toltec-dev/build' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
needs: [standalone, build]
runs-on: ubuntu-latest
strategy:
matrix:
artifact:
- 'pip'
- 'toltecmk'
permissions:
contents: write
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Download executable
id: download
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist
- name: Upload to release
run:
find . -type f | xargs -rI {} gh release upload "$TAG" {} --clobber
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.event.release.tag_name }}
working-directory: ${{ steps.download.outputs.download-path }}