Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate unit and integration tests from TravisCI to GitHub Actions #580

Merged
merged 19 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/actions/install-icepyx/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Install icepyx'
description: 'Install icepyx and dev dependencies'

inputs:
python-version:
required: true

runs:
using: "composite"
steps:
- uses: "actions/setup-python@v5"
with:
python-version: "${{ inputs.python-version }}"

- name: "Install package and test dependencies"
shell: "bash"
run: |
python -m pip install .
python -m pip install -r requirements-dev.txt
51 changes: 51 additions & 0 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Integration test"
# NOTE: We're just running the tests that require earthdata login here; we
# don't distinguish between unit and integration tests yet.

on:
push:
branches:
- "main" # Releases
- "development" # PR merges
pull_request:
branches:
- "main" # Release pull requests
pull_request_review:
types:
- "submitted"
paths:
- ".github/**"
- "icepyx/**/*.py"
- "pyproject.toml"
- "requirements*.txt"


jobs:
test:
name: "Integration test"
# Do not run on PRs from forks:
if: "${{ !github.event.pull_request.head.repo.fork }}"
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0

- uses: "./.github/actions/install-icepyx"
with:
python-version: "3.12"

- name: "Run tests"
env:
EARTHDATA_PASSWORD: "${{ secrets.EARTHDATA_PASSWORD }}"
mfisher87 marked this conversation as resolved.
Show resolved Hide resolved
NSIDC_LOGIN: "${{ secrets.EARTHDATA_PASSWORD }}"
run: |
pytest icepyx/ --verbose --cov app \
icepyx/tests/test_behind_NSIDC_API_login.py \
icepyx/tests/test_auth.py

- name: "Upload coverage report"
uses: "codecov/[email protected]"
with:
token: "${{ secrets.CODECOV_TOKEN }}"
40 changes: 40 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Unit test"
# NOTE: We're just skipping the tests requiring earthdata login here; we don't
# distinguish yet between unit and integration tests.

on:
pull_request:
push:
branches:
- "main"
- "development"


jobs:
test:
name: "Unit test (Python ${{ matrix.python-version }})"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"] #NOTE: min and max Python versions supported by icepyx

steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0

- uses: "./.github/actions/install-icepyx"
with:
python-version: "${{ matrix.python-version }}"

- name: "Run tests"
run: |
pytest icepyx/ --verbose --cov app \
--ignore=icepyx/tests/test_behind_NSIDC_API_login.py \
--ignore=icepyx/tests/test_auth.py

- name: "Upload coverage report"
uses: "codecov/[email protected]"
with:
token: "${{ secrets.CODECOV_TOKEN }}"
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Current development version (development branch): |Docs Status dev| |Travis dev
.. |Docs Status dev| image:: https://readthedocs.org/projects/icepyx/badge/?version=development
:target: https://icepyx.readthedocs.io/en/development

.. |Travis main Build Status| image:: https://app.travis-ci.com/icesat2py/icepyx.svg?branch=main
:target: https://app.travis-ci.com/icesat2py/icepyx
.. |Tests Status (main)| image:: https://github.com/icesat2py/icepyx/actions/workflows/integration_test.yml/badge.svg?branch=main
:target: https://github.com/icesat2py/icepyx/actions/workflows/integration_test.yml

mfisher87 marked this conversation as resolved.
Show resolved Hide resolved
.. |Travis dev Build Status| image:: https://app.travis-ci.com/icesat2py/icepyx.svg?branch=development
:target: https://app.travis-ci.com/icesat2py/icepyx
.. |Tests Status (dev)| image:: https://github.com/icesat2py/icepyx/actions/workflows/integration_test.yml/badge.svg?branch=development
:target: https://github.com/icesat2py/icepyx/actions/workflows/integration_test.yml
mfisher87 marked this conversation as resolved.
Show resolved Hide resolved
mfisher87 marked this conversation as resolved.
Show resolved Hide resolved

.. |Code Coverage main| image:: https://codecov.io/gh/icesat2py/icepyx/branch/main/graph/badge.svg
:target: https://codecov.io/gh/icesat2py/icepyx
Expand Down