Skip to content

Commit

Permalink
Migrate to GitHub actions (#33)
Browse files Browse the repository at this point in the history
This PR migrates our CI/CD from Travis to Github Actions.

Instead of one deployment, I split into three workflows:
- Run the test suite on every push, in every branch
- Deploy to pypi when the default branch (master in our case) receives a new commit and has a diepvries/* tag
- Build and deploy docs to Github Pages when the default branch receives a new commit and has a diepvries/* tag

To enable this, I changed the following repository settings:
- Added TWINE_PASSWORD to the repository secrets.
- Changed Github Pages deployment source from the gh-pages branch to Github Actions.
  • Loading branch information
michael-the1 authored Aug 25, 2022
1 parent 9c210d8 commit 5ccad50
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 34 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/pages-build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: pages-build-and-deploy

# Only run this workflow when a diepvries/* tag gets pushed
on:
push:
tags:
- diepvries/*

jobs:
deploy-github-pages:
runs-on: ubuntu-22.04

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4.2.0
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y graphviz
python -m pip install tox
- name: Run tox
run: python -m tox -e doc
- name: Configure Pages
uses: actions/configure-pages@v1.1.0
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v1.0.3
with:
path: doc/html
- name: Deploy GitHub Pages site
id: deployment
uses: actions/deploy-pages@v1.0.8
29 changes: 29 additions & 0 deletions .github/workflows/pypi-build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: pypi-build-and-deploy

# Only run this workflow when a diepvries/* tag gets pushed
on:
push:
tags:
- diepvries/*

jobs:
deploy-to-pypi:
runs-on: ubuntu-22.04

env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4.2.0
with:
python-version: 3.9
- name: Install dependencies
run: python -m pip install tox
- name: Run tox
run: python -m tox -e build -e upload
22 changes: 22 additions & 0 deletions .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: run-test-suite
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.8", "3.9"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -m pip install tox
- name: Run tests
run: python -m tox -e py -e lint
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Added
- Add `StagingTable` class.
- Add `StagingTable` class (#30).
- Add the pre-commit tool (#34).
- Changed CI/CD from Travis to Github Actions (#33).

## [0.6.2] - 2021-08-20
### Added
Expand Down

0 comments on commit 5ccad50

Please sign in to comment.