Skip to content

Commit

Permalink
Move tests to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Melanie Clarke committed Jul 30, 2023
1 parent 5f8eb7e commit 072f035
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 119 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# GitHub Actions workflow for testing and continuous integration.
#
# This file performs testing using tox and tox.ini to define and configure the test environments.

name: CI

on:
push:
branches:
- main
pull_request:
# branches: # only build on PRs against 'main' if you need to further limit when CI is run.
# - main
# schedule: # schedule a regular run if needed
# # Weekly Monday 9AM build
# - cron: "0 9 * * 1"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
envs: |
- linux: test-alldeps
python-version: 3.11
- macos: test-alldeps
python-version: 3.11
- windows: test-alldeps
python-version: 3.11
build-docs:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
cache-path: docs/_build/html
cache-key: docs-${{ github.run_id }}
envs: |
- linux: build-docs
deploy-docs:
runs-on: ubuntu-latest
needs: build-docs
steps:
- name: Download docs artifact
uses: actions/cache@v3
with:
path: docs/_build/html
key: docs-${{ github.run_id }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
force_orphan: true
119 changes: 0 additions & 119 deletions .travis.yml

This file was deleted.

90 changes: 90 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
[tox]
envlist =
check-{style,security}
test{,-oldestdeps,-alldeps}{,-pyargs,-warnings,-cov}
build-{docs,dist}

# tox environments are constructed with so-called 'factors' (or terms)
# separated by hyphens, e.g. test-oldestdeps-cov. Lines below starting with factor:
# will only take effect if that factor is included in the environment name. To
# see a list of example environments that can be run, along with a description,
# run:
#
# tox -l -v
#

[testenv:check-style]
description = check code style with ruff
skip_install = true
deps =
ruff
commands =
ruff check sofia_redux

[testenv:check-security]
description = run bandit to check security compliance
skip_install = true
deps =
bandit>=1.7
commands =
bandit -r -ll -x sofia_redux/*test* -x sofia_redux/*/*test* sofia_redux

[testenv]
description =
run tests
oldestdeps: with the oldest supported version of key dependencies
alldeps: with all optional dependencies
pyargs: with --pyargs on installed package
warnings: treating warnings as errors
cov: with coverage
pass_env =
TOXENV
CI
CODECOV_*
HOME
STRICT_VALIDATION
PASS_INVALID_VALUES
VALIDATE_ON_ASSIGNMENT
extras =
test
alldeps: all
alldeps: docs
deps =
oldestdeps: minimum_dependencies
package =
!pyargs: editable
pyargs: wheel
commands_pre =
# Generate a requirements-min.txt file
oldestdeps: minimum_dependencies sofia_redux --filename requirements-min.txt
# Force install everything in that file
oldestdeps: pip install -r requirements-min.txt
pip freeze
commands =
pip freeze
pytest \
cov: --cov=sofia_redux --cov-report=xml --cov-report=html
warnings: -W error \
pyargs: {toxinidir}/docs --pyargs sofia_redux \
{posargs}

[testenv:build-docs]
description = invoke sphinx-build to build the HTML docs
extras =
docs
all
allowlist_externals =
rm
commands =
rm -rf docs/api docs/_build
sphinx-build docs docs/_build/html

[testenv:build-dist]
description = check build sdist/wheel
skip_install = true
allowlist_externals = rm
deps =
build
commands =
rm -rf dist
python -m build

0 comments on commit 072f035

Please sign in to comment.