-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (80 loc) · 3.76 KB
/
python-test.yml
File metadata and controls
90 lines (80 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Python Package testing
run-name: "Testing ${{ inputs.matrix_os }}"
on:
workflow_call:
inputs:
matrix_os:
required: true
type: string
description: "matrix.os to be ran"
fermitools_pkg_ver:
required: true
type: string
description: "Fermitools package version"
build_label:
required: true
type: string
description: "Fermitools package build label"
# Just check out the Parent ScienceTools repo, we don't need the submodules.
# Just recipe/tests directory. All testing will be ran from that directory.
# ${{github.ref_name}} was used to save updating the branch names in multiple files during development.
# New python dependency environment file was creating for testing : environments/fermitools-testing.yml
jobs:
test:
runs-on: ${{ inputs.matrix_os }}
name: "Testing- ${{ inputs.matrix_os }} "
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout just ScienceTools repo
uses: actions/checkout@v4
with:
ref: ${{github.ref_name}} #reset_checkout_fixes checkout_fixes master
- name: Conda environment creation and activation
uses: conda-incubator/setup-miniconda@v3
with:
conda-remove-defaults: true
python-version: 3.11.*
activate-environment: testing-env
environment-file: environments/fermitools-testing.yml
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
# Currently, every conda build package has to be uploaded to Anaconda, so the package name can be passed onto this workflow.
# It's a bug on the build actions team to fix. The alternative is to upload it as an artifact to Github server, and pass that reference around instead.
# So this code is being kept around , just in case we want to pivot:
# - name: Download Conda package artifact
# uses: actions/download-artifact@v4
# with:
# name: "${{ matrix.os }}-fermitools-package"
# path: downloaded-package # Directory where the artifact will be downloaded
# Currently, we only run : ST-unit-test
# But the plan is to include Tom's Likelihood tests, Threads testing that Don does manually, and Nestor is creating jupyter notebooks that can be ran as tests too.
# BUG: This doesn't handle Tags RC and MAIN, it will only pull from tag dev.
- name: Run tests by hand
id: run_tests_again
# CONTINUE_ON_ERROR is set under GH website / Settings/Actions secrets and variables/Repository variables
## moved to main-ci.yml : continue-on-error: ${{ fromJSON(vars.CONTINUE_ON_ERROR || 'false') }} # Default is to fail at first error
run: |
echo "Run tests testing-env"
echo "TESTING BRANCH ${{ github.ref_name }}"
conda install --name testing-env "fermi/label/${{inputs.build_label}}::fermitools=${{inputs.fermitools_pkg_ver}}" python=3.11
mkdir -p test_results
cd test_results/
../recipe/tests/ST-unit-test -w -d -v
# The layout for this reporting action works. Not sure if there is something better, but it does a good job for us.
- name: Publish Test Results Linux
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: runner.os == 'Linux'
with:
check_name: "Test Results ${{ inputs.matrix_os }}"
files: |
${{ github.workspace }}/test_results/ST-unit-test-Output.xml
- name: Publish Test Results OSX
uses: EnricoMi/publish-unit-test-result-action/macos@v2
if: runner.os == 'macOS'
with:
check_name: "Test Results ${{ inputs.matrix_os }}"
files: |
${{ github.workspace }}/test_results/ST-unit*.xml