Skip to content

CI

CI #895

Workflow file for this run

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *' # test daily against git HEAD of dependencies
name: CI
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 'pypy-3.9'
- 'pypy-3.10'
# this version range needs to be synchronized with the one in pyproject.toml
amaranth-version:
- '0.5'
- 'git'
allow-failure:
- false
continue-on-error: '${{ matrix.allow-failure }}'
name: 'test (${{ matrix.python-version }}, HDL ${{ matrix.amaranth-version }})'
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install codecov
pdm install --dev
- name: Install Amaranth release
if: ${{ matrix.amaranth-version != 'git' }}
run: |
pip install 'amaranth==${{ matrix.amaranth-version }}'
- name: Install Amaranth from git
if: ${{ matrix.amaranth-version == 'git' }}
run: |
pip install git+https://github.com/amaranth-lang/amaranth.git
- name: Run tests
run: |
pdm run test
- name: Submit code coverage
run:
codecov
document:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags from upstream repository
run: |
git fetch --tags https://github.com/amaranth-lang/amaranth-soc.git
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
pdm install --dev
- name: Build documentation
run: |
pdm run document
- name: Upload documentation archive
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build
required: # group all required workflows into one to avoid reconfiguring this in Actions settings
needs:
- test
- document
if: always() && !contains(needs.*.result, 'cancelled')
runs-on: ubuntu-latest
steps:
- run: ${{ contains(needs.*.result, 'failure') && 'false' || 'true' }}
publish-docs:
needs: document
if: github.repository == 'amaranth-lang/amaranth-soc'
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download documentation archive
uses: actions/download-artifact@v4
with:
name: docs
path: docs/
- name: Publish development documentation
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
repository-name: amaranth-lang/amaranth-lang.github.io
ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }}
branch: main
folder: docs/
target-folder: docs/amaranth-soc/latest/
- name: Publish release documentation
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
repository-name: amaranth-lang/amaranth-lang.github.io
ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }}
branch: main
folder: docs/
target-folder: docs/amaranth-soc/${{ github.ref_name }}/
publish-docs-dev:
needs: document
if: github.repository != 'amaranth-lang/amaranth-soc'
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download documentation archive
uses: actions/download-artifact@v4
with:
name: docs
path: pages/docs/${{ github.ref_name }}/
- name: Disable Jekyll
run: |
touch pages/.nojekyll
- name: Publish documentation for a branch
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
folder: pages/
clean: false