Skip to content

Commit

Permalink
create automated testing workflows
Browse files Browse the repository at this point in the history
sgathrid committed Aug 17, 2024
1 parent 753961a commit 90070bd
Showing 2 changed files with 60 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Run Tests and Report Results
description: Set up the Conda environment and run tests using pytest.

inputs:
environment-file:
description: The Conda environment file to use.
required: true
default: environment.yml

runs:
using: composite
steps:
- name: Set up Conda
uses: ../setup-conda # Use the setup-conda action from your repo
with:
environment-file: ${{ inputs.environment-file }}

- name: Run pytest
run: |
conda run -n test pytest
shell: bash -el {0}
39 changes: 39 additions & 0 deletions .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run Tests

env:
ENV_FILE: environment.yml
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Activate Conda Environment
uses: ./.github/actions/setup-conda
with:
environment-file: ${{ env.ENV_FILE }}

- name: Run pytest
run: |
conda run -n test pytest --junitxml=test-data.xml
shell: bash -el {0}

- name: Publish Test Results
uses: actions/upload-artifact@v4
with:
name: Test results
path: test-data.xml

0 comments on commit 90070bd

Please sign in to comment.