Skip to content

Commit

Permalink
Merge pull request #85 from nanograv/hotfix/ng20-tests
Browse files Browse the repository at this point in the history
Transferring GitHub Actions Fixes to NG20 Branch
  • Loading branch information
rossjjennings authored Oct 24, 2024
2 parents 382c240 + 48d323a commit 2d812e5
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 23 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/commenting_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Bind Reports to Pull-Request

# Triggered by the name of the previos
on:
workflow_run:
workflows: ["Notebook Pipeline (Ubuntu)"]
types: [completed]

# Enable the option to post a comment
permissions:
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
# Check that the previos workflow succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Get Artifacts Link
env:
WORKFLOW_RUN_EVENT_OBJ: ${{ toJSON(github.event.workflow_run) }}
GH_TOKEN: ${{ github.token }}
run: |
PREVIOUS_JOB_ID=$(jq -r '.id' <<< "$WORKFLOW_RUN_EVENT_OBJ")
SUITE_ID=$(jq -r '.check_suite_id' <<< "$WORKFLOW_RUN_EVENT_OBJ")
# Sample for a single artifact, can be improved for a multiple artifacts
ARTIFACT_ID=$(gh api "/repos/${{ github.repository }}/actions/artifacts" \
--jq ".artifacts.[] |
select(.workflow_run.id==${PREVIOUS_JOB_ID}) |
.id")
echo "ARTIFACT_URL=https://github.com/${{ github.repository }}/suites/${SUITE_ID}/artifacts/${ARTIFACT_ID}" >> $GITHUB_ENV
PR_NUMBER=$(jq -r '.pull_requests[0].number' <<< "$WORKFLOW_RUN_EVENT_OBJ")
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
- uses: actions/github-script@v6
env:
PR_NUMBER: ${{ env.PR_NUMBER }}
PR_NOTES: |
Build artifacts:
| Name | Link |
|------|------|
| NB/WB Pipeline | [Archived ZIP](${{ env.ARTIFACT_URL }}) |
with:
script: |
github.rest.issues.createComment({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.PR_NOTES
})
65 changes: 42 additions & 23 deletions .github/workflows/test_notebook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,64 @@ on:

jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest] # Once we get the tex packages changed, we should include "macos-13"
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: Install pdflatex
- name: Install Required Ubuntu Packages
run: |
sudo apt-get update
sudo apt-get install texlive-latex-base cm-super-minimal pdftk latex2html
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
- name: Conda info
shell: bash -el {0}
run: conda info
- name: Install Dependencies & Main Code
init-shell: bash
environment-name: pulsar
cache-environment: true
cache-downloads: true
create-args: >-
-c conda-forge
python=${{ matrix.python-version }}
pytest
cython
pint-pulsar
tempo2
libstempo
enterprise-pulsar
enterprise_extensions
scikit-sparse
scikit-learn
ruamel.yaml
nbconvert
ipywidgets>=7.6.3
weasyprint
pytest-xdist>=2.3.0
jupyter
seaborn
gitpython
- name: Install Main Code
shell: bash -el {0}
run: |
mamba install -c conda-forge python=${{ matrix.python-version }} pytest cython=0.29.36 tempo2 enterprise-pulsar enterprise_extensions scikit-sparse
pip install -e .
- name: Test with Standard Pulsar
shell: bash -el {0}
run: |
export PULSAR_NAME='J0605+3757'
export JUPYTER_PLATFORM_DIRS=1 && jupyter --paths
tree tests
pytest tests/test_run_notebook.py -n auto -k $PULSAR_NAME
mv tmp-* nb_outputs
export JUPYTER_PLATFORM_DIRS=1
pytest tests/test_run_notebook.py -k $PULSAR_NAME
ls -lah
mv tmp* nb_outputs
- name: Archive Notebook Output Files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: TestNB-OutputFiles
name: TestNB-OutputFiles_${{ matrix.python-version }}_${{ matrix.os }}_${{ steps.date.outputs.date }}
path: |
nb_outputs
nb_outputs/*/*.pdf
nb_outputs/*/*.tim
nb_outputs/*/*.par
compression-level: 6

0 comments on commit 2d812e5

Please sign in to comment.