Skip to content

Improving CI/CD for Github actions #120

Improving CI/CD for Github actions

Improving CI/CD for Github actions #120

Workflow file for this run

name: CI testing
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install --upgrade pip build
- run: pip install build
- run: python -m build --sdist --wheel
- run: pip install .
- run: pip uninstall -y montepy
- run: pip install --user dist/*.whl
- run: pip uninstall -y montepy
- run: pip install --user dist/*.tar.gz
- run: pip install --user . montepy[test]
- run: pip install --user . montepy[doc]
- run: pip install --user . montepy[format]
- run: pip install --user . montepy[build]
- run: pip install --user . montepy[develop]
- run: pip freeze
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: dist/*
test:
runs-on: ubuntu-latest
permissions: write-all
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install --user . montepy[test]
- run: coverage run -m pytest --junitxml=test_report.xml
- run: coverage report
- run: coverage xml
- name: Upload test report
if: ${{ matrix.python-version == '3.9' }}
uses: actions/upload-artifact@v4
with:
name: test
path: test_report.xml
- name: Upload coverage report
if: ${{ matrix.python-version == '3.9' }}
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.xml
- name: Test Reporter
if: ${{ matrix.python-version == '3.9' }}
uses: dorny/[email protected]
with:
name: CI-test-report
path: test_report.xml
reporter: java-junit
- name: Coveralls GitHub Action
if: ${{ matrix.python-version == '3.9' }}
uses: coverallsapp/[email protected]
with:
file: coverage.xml
doc-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- run: pip install . montepy[doc]
- run: sphinx-build doc/source/ doc/build/ -W --keep-going -E
- run: sphinx-build -b html doc/source/ doc/build/html
- uses: actions/upload-artifact@v3
with:
name: website
path: doc/build/html
- name: Test for missing API documentation
run: |
cd doc/source
python _test_for_missing_docs.py
format-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- run: pip install . montepy[format]
- run: black --check montepy/ tests/