From 70b846fba163e97ee28b20b786c96926e6157a3f Mon Sep 17 00:00:00 2001 From: Joseph Glaser Date: Thu, 24 Oct 2024 19:11:13 +0000 Subject: [PATCH 1/2] Transfering new fix. --- .github/workflows/test_notebook.yml | 65 +++++++++++++++++++---------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test_notebook.yml b/.github/workflows/test_notebook.yml index eddc18d..1333e42 100644 --- a/.github/workflows/test_notebook.yml +++ b/.github/workflows/test_notebook.yml @@ -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 + \ No newline at end of file From 48d323a4d5a622a755615d361034e8862824d685 Mon Sep 17 00:00:00 2001 From: Joseph Glaser Date: Thu, 24 Oct 2024 19:12:05 +0000 Subject: [PATCH 2/2] Adding uploading to commits. --- .github/workflows/commenting_artifacts.yml | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/commenting_artifacts.yml diff --git a/.github/workflows/commenting_artifacts.yml b/.github/workflows/commenting_artifacts.yml new file mode 100644 index 0000000..bd7bc20 --- /dev/null +++ b/.github/workflows/commenting_artifacts.yml @@ -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 + }) \ No newline at end of file