CI/CD #606
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: | |
branches: | |
- main | |
pull_request: | |
# Run daily at 0:01 UTC | |
schedule: | |
- cron: '1 0 * * *' | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install -q .[celery] | |
python -m pip install -q --upgrade pyflakes 'pytest>=3.6' pytest-cov python-coveralls | |
python -m pip list | |
- name: Lint with Pyflakes | |
if: matrix.python-version == '3.11' | |
run: | | |
python -m pyflakes packtivity | |
- name: Test with pytest | |
run: | | |
python -m pytest --cov=packtivity -vv | |
- name: Run packtivity tests | |
run: | | |
packtivity-run tests/testspecs/noop-test.yml -p a_parameter=hello | |
- name: Report coverage with Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests-${{ matrix.python-version }} | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --ignore-installed -U -q --no-cache-dir -e . | |
python -m pip install sphinx | |
python -m pip list | |
sudo apt-get update | |
sudo apt-get -qq install pandoc | |
- name: Test and build docs | |
run: | | |
cd docs | |
make html | |
cd .. | |
touch docs/_build/html/.nojekyll | |
- name: Deploy docs to GitHub Pages | |
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_build/html | |
force_orphan: true | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
commit_message: Deploy to GitHub pages | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Test build | |
id: docker_build_test | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
tags: ${{ github.sha }} | |
load: true | |
push: false | |
- name: List built images | |
run: docker images |