Skip to content

Commit

Permalink
Add testing and packaging files (#325)
Browse files Browse the repository at this point in the history
Add testing and packaging files
  • Loading branch information
ktactac-ornl authored Jan 9, 2025
1 parent 22f7504 commit 6fc28bd
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 594 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Workflow files stored in the default location of `.github/workflows`
schedule:
interval: "weekly"
File renamed without changes.
45 changes: 45 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: conda packaging and deployment

on:
workflow_dispatch:
push:
branches: [qa, main]
tags: ['v*']

jobs:
linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge,defaults
use-mamba: true
environment-file: environment.yml
- name: install additional dependencies
run: |
echo "installing additional dependencies from environment_development.yml"
- name: build conda package
run: |
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
VERSION=$(versioningit ../) conda mambabuild --channel conda-forge --output-folder . .
conda verify noarch/drtsans*.tar.bz2
- name: upload conda package to anaconda
shell: bash -l {0}
if: startsWith(github.ref, 'refs/tags/v')
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
IS_RC: ${{ contains(github.ref, 'rc') }}
run: |
# label is main or rc depending on the tag-name
CONDA_LABEL="main"
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
echo pushing ${{ github.ref }} with label $CONDA_LABEL
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/drtsans*.tar.bz2
61 changes: 61 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: test

on:
workflow_dispatch:
pull_request:
push:
branches: [next, qa, main]
tags: ['v*']

jobs:
linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge,defaults
use-mamba: true
environment-file: environment.yml
lfs: true
submodules: recursive
- name: install additional dependencies
run: |
echo "installing additional dependencies if cannot be installed from conda"
- name: test preparation
run: |
python -m pip install -e .
versioningit -vw
git lfs pull
git submodule update --init --recursive
- name: run unit tests
run: |
echo "running unit tests"
python -m pytest -m "not mount_eqsans" -vv --dist loadscope -n 2 --cov=src --cov-report=xml:unit_test_coverage.xml --cov-report=term --junitxml=unit_test_results.xml tests/unit/
- name: run integration tests
run: |
echo "running integration tests"
python -m pytest -m "not mount_eqsans" -vv --dist loadscope -n 2 --cov=src --cov-report=xml:integration_test_coverage.xml --cov-report=term --junitxml=integration_test_results.xml tests/integration/
- name: upload coverage to codecov
uses: codecov/codecov-action@v5
if:
github.actor != 'dependabot[bot]'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: |
unit_test_coverage.xml
integration_test_coverage.xml
- name: build conda package
run: |
# test that the conda package builds
cd conda.recipe
echo "versioningit $(versioningit ../)"
# conda channels could have been defined in the conda-incubator, but you can copy/paste the lines
# below to build the conda package in your local machine
CHANNELS="--channel mantid/label/main --channel conda-forge"
VERSION=$(versioningit ../) conda mambabuild $CHANNELS --output-folder . .
conda verify noarch/drtsans*.tar.bz2
Loading

0 comments on commit 6fc28bd

Please sign in to comment.