From 971015619c320949de20a933c258395555cdbff0 Mon Sep 17 00:00:00 2001 From: _youteakay Date: Fri, 19 Apr 2024 18:42:55 +0530 Subject: [PATCH 1/2] Update build_test_notebooks.yml --- .github/workflows/build_test_notebooks.yml | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/build_test_notebooks.yml diff --git a/.github/workflows/build_test_notebooks.yml b/.github/workflows/build_test_notebooks.yml new file mode 100644 index 0000000..85200b8 --- /dev/null +++ b/.github/workflows/build_test_notebooks.yml @@ -0,0 +1,64 @@ +name: Build & Test Notebooks + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build-notebooks: + runs-on: ubuntu-latest + + steps: + - name: Checkout stingray repo + uses: actions/checkout@v4 + with: + repository: StingraySoftware/stingray + path: ./stingray + submodules: recursive + + - name: Get latest commit of the PR + id: pr_commit + run: | + echo "PR_SHA=$(curl -s 'https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}' | jq -r .head.sha)" >> $GITHUB_ENV + if [ "$PR_SHA" == "null" ]; then + echo "::error::Failed to get PR SHA" + exit 1 + fi + echo "commit=$PR_SHA" >> $GITHUB_ENV + + - name: Checkout PR version of notebooks + run: | + cd ./stingray/docs/notebooks # Change to the submodule directory + pwd + git fetch origin ${{ env.commit }}:pr_temp + git checkout pr_temp + + - name: Verify submodule update + run: | + cd ./stingray/docs/notebooks + git log -1 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install pandoc and additional dependencies + run: | + sudo apt-get update + sudo apt-get install -y pandoc fonts-freefont-ttf + pip install sphinx sphinx-astropy tox + + - name: Install Stingray + run: | + pip install -e ./stingray + + - name: Run Build Docs + run: | + cd ./stingray + tox -e build_docs From 51927199bbc228cedcb76ccc9ffb06c2f4aa7648 Mon Sep 17 00:00:00 2001 From: _youteakay Date: Fri, 19 Apr 2024 18:54:24 +0530 Subject: [PATCH 2/2] Try --- .github/workflows/build_docs.yml | 37 ---------------------- .github/workflows/build_test_notebooks.yml | 10 ++---- 2 files changed, 3 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/build_docs.yml diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml deleted file mode 100644 index 487cec5..0000000 --- a/.github/workflows/build_docs.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build & Test Notebooks - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - build-notebooks: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install pandoc - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - pip install -e ".[docs]" - - name: Build notebooks - run: | - make html - working-directory: notebooks - - name: Test notebooks - run: | - for notebook in notebooks/*.ipynb; do - jupyter nbconvert --execute --inplace --ExecutePreprocessor.timeout=600 $notebook; - done - working-directory: notebooks diff --git a/.github/workflows/build_test_notebooks.yml b/.github/workflows/build_test_notebooks.yml index 85200b8..5eff983 100644 --- a/.github/workflows/build_test_notebooks.yml +++ b/.github/workflows/build_test_notebooks.yml @@ -21,21 +21,17 @@ jobs: path: ./stingray submodules: recursive - - name: Get latest commit of the PR - id: pr_commit + - name: Get latest commit of the PR and Checkout PR version of notebooks run: | - echo "PR_SHA=$(curl -s 'https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}' | jq -r .head.sha)" >> $GITHUB_ENV + PR_SHA=$(curl -s 'https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}' | jq -r .head.sha) if [ "$PR_SHA" == "null" ]; then echo "::error::Failed to get PR SHA" exit 1 fi echo "commit=$PR_SHA" >> $GITHUB_ENV - - - name: Checkout PR version of notebooks - run: | cd ./stingray/docs/notebooks # Change to the submodule directory pwd - git fetch origin ${{ env.commit }}:pr_temp + git fetch origin $PR_SHA:pr_temp git checkout pr_temp - name: Verify submodule update