Skip to content

Commit

Permalink
Make minor CI improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
  • Loading branch information
kbattocchi committed Oct 11, 2023
1 parent 05d1d46 commit 8975714
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
42 changes: 33 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ jobs:
version: '3.9'
install_graphviz: false
fail-fast: false
env:
id_string: ${{ matrix.kind }}-${{ matrix.version }}
steps:
- uses: actions/checkout@v3
name: Checkout repository
Expand All @@ -148,13 +150,13 @@ jobs:
- run: pip install jupyter jupyter-client nbconvert nbformat seaborn xgboost tqdm
name: Install notebook requirements
if: ${{ !env.use_lkg }}
- run: pip freeze --exclude-editable > notebooks-${{ matrix.version }}-${{ matrix.kind }}-requirements.txt
- run: pip freeze --exclude-editable > notebooks-${{ env.id_string }}-requirements.txt
name: Save installed packages
- uses: actions/upload-artifact@v3
name: Upload installed packages
with:
name: requirements
path: notebooks-${{ matrix.version }}-${{ matrix.kind }}-requirements.txt
path: notebooks-${{ env.id_string }}-requirements.txt
- run: pip install pytest pytest-runner coverage
name: Install pytest

Expand All @@ -165,7 +167,7 @@ jobs:
PYTEST_ADDOPTS: '-m "notebook"'
NOTEBOOK_DIR_PATTERN: ${{ matrix.pattern }}
COVERAGE_PROCESS_START: 'setup.cfg'
- run: mv .coverage .coverage.${{ matrix.kind }}
- run: mv .coverage .coverage.${{ env.id_string }}
# Run whether or not the tests passed, but only if they ran at all
if: success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
name: Make coverage filename unique
Expand All @@ -174,8 +176,18 @@ jobs:
if: success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
with:
name: coverage
path: .coverage.${{ matrix.kind }}

path: .coverage.${{ env.id_string }}
- run: mv junit/test-results.xml ${{ env.id_string }}-test-results.xml
# Run whether or not the tests passed, but only if they ran at all
if: success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
name: Make test XML filename unique
- uses: actions/upload-artifact@v3
name: Upload test XML files
if: success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
with:
name: tests
path: ${{ env.id_string }}-test-results.xml

tests:
name: "Run tests"
needs: [eval]
Expand Down Expand Up @@ -211,6 +223,8 @@ jobs:
extras: "[tf,plt]"
fail-fast: false
runs-on: ${{ matrix.os }}
env:
id_string: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
steps:
- uses: actions/checkout@v3
name: Checkout repository
Expand All @@ -225,13 +239,13 @@ jobs:
# Add verbose flag to pip installation if in debug mode
- run: pip install -e .${{ matrix.extras }} ${{ fromJSON('["","-v"]')[runner.debug] }} ${{ env.use_lkg && '-r lkg.txt' }}
name: Install econml
- run: pip freeze --exclude-editable > tests-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}-requirements.txt
- run: pip freeze --exclude-editable > tests-${{ env.id_string }}-requirements.txt
name: Save installed packages
- uses: actions/upload-artifact@v3
name: Upload installed packages
with:
name: requirements
path: tests-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}-requirements.txt
path: tests-${{ env.id_string }}-requirements.txt
- run: pip install pytest pytest-runner coverage
name: Install pytest
- run: python setup.py pytest
Expand All @@ -240,7 +254,7 @@ jobs:
env:
PYTEST_ADDOPTS: ${{ matrix.opts }}
COVERAGE_PROCESS_START: 'setup.cfg'
- run: mv .coverage .coverage.${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
- run: mv .coverage .coverage.${{ env.id_string }}
# Run whether or not the tests passed, but only if they ran at all
if: success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
name: Make coverage filename unique
Expand All @@ -249,7 +263,17 @@ jobs:
if: success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
with:
name: coverage
path: .coverage.${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }}
path: .coverage.${{ env.id_string }}
- run: mv junit/test-results.xml ${{ env.id_string }}-test-results.xml
# Run whether or not the tests passed, but only if they ran at all
if: success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
name: Make test XML filename unique
- uses: actions/upload-artifact@v3
name: Upload test XML files
if: success() || failure() && contains(fromJSON('["success", "failure"]'), steps.run_tests.outcome)
with:
name: tests
path: ${{ env.id_string }}-test-results.xml

coverage-report:
name: "Coverage report"
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/publish-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ on:
required: false
default: True
type: boolean
run_doctests:
description: 'Whether to run doctests'
required: false
default: True
type: boolean
# annoyingly, there does not seem to be a way to share these input definitions between triggers
workflow_call:
inputs:
Expand All @@ -47,6 +52,11 @@ on:
required: false
default: True
type: boolean
run_doctests:
description: 'Whether to run doctests'
required: false
default: True
type: boolean

jobs:
create_docs:
Expand Down Expand Up @@ -74,6 +84,9 @@ jobs:
with:
name: docs
path: build/sphinx/html/
- run: python setup.py build_sphinx -b doctest
name: Run doctests
if : ${{ inputs.run_doctests }}
- run: |-
pushd build/sphinx/html
zip -r docs.zip *
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down

0 comments on commit 8975714

Please sign in to comment.