CI/CD #1316
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
pull_request: | |
# Run daily at 0:01 UTC | |
schedule: | |
- cron: '1 0 * * *' | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.7', '3.8', '3.9', '3.10'] | |
include: | |
- os: macos-latest | |
python-version: '3.7' | |
- os: macos-latest | |
python-version: '3.10' | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip --no-cache-dir install --quiet .[complete] | |
python -m pip list | |
- name: Lint with flake8 | |
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' | |
run: | | |
flake8 . | |
- name: Lint with Black | |
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' | |
run: | | |
black --check --diff --verbose . | |
- name: Check MANIFEST | |
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' | |
run: | | |
check-manifest | |
- name: Test with pytest | |
run: | | |
pytest -r sx tests | |
- name: Report coverage with Codecov | |
if: github.event_name == 'push' && matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests-${{ matrix.python-version }} | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build Docker image | |
if: "!(startsWith(github.ref, 'refs/tags/'))" | |
uses: docker/build-push-action@v1 | |
with: | |
repository: pyhf/pyhf-validation | |
dockerfile: docker/Dockerfile | |
tag_with_sha: true | |
tag_with_ref: true | |
push: false | |
- name: List built images | |
run: docker images |