diff --git a/.github/config.json b/.github/config.json deleted file mode 100644 index d75c5db..0000000 --- a/.github/config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "notebook_name": "", - "kernel": "", - "quay_image": "" -} \ No newline at end of file diff --git a/.github/workflows/binder.yaml b/.github/workflows/binder.yaml index d5571b3..92a6837 100644 --- a/.github/workflows/binder.yaml +++ b/.github/workflows/binder.yaml @@ -1,30 +1,10 @@ # Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html name: Test this PR on Binder Badge + on: pull_request_target: types: [opened] -permissions: - pull-requests: - write - jobs: binder: - runs-on: ubuntu-latest - steps: - - name: comment on PR with Binder link - uses: actions/github-script@v3 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO; - var PR_HEAD_REF = process.env.PR_HEAD_REF; - github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}) :point_left: Test this PR on Binder` - }) - env: - PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} - PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }} + uses: eds-book/notebooks-workflows/.github/workflows/binder.yaml@main \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8b49ac5..0d63ea2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,47 +2,14 @@ name: Build and push container image on: push: - branches: - - main - - postprint + branches: [main, postprint] + paths-ignore: + - 'README.md' + - 'netlify.toml' jobs: build-and-push: - runs-on: ubuntu-latest - if: github.repository_owner == 'eds-book-gallery' - steps: - # For biggish images, github actions runs out of disk space. - # So we cleanup some unwanted things in the disk image, and reclaim that space for our docker use - # https://github.com/actions/virtual-environments/issues/2606#issuecomment-772683150 - # and https://github.com/easimon/maximize-build-space/blob/b4d02c14493a9653fe7af06cc89ca5298071c66e/action.yml#L104 - # This gives us a total of about 52G of free space, which should be enough for now - - name: cleanup disk space - run: | - sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc - df -h - - - name: Checkout files in repo - uses: actions/checkout@main - - # Set quay image - - name: Get properties from the config file - id: config_quay - uses: notiz-dev/github-action-json-property@release - with: - path: '.github/config.json' - prop_path: 'quay_image' - - - name: Build and push the image to quay.io - uses: jupyterhub/repo2docker-action@master - with: - # Make sure username & password/token pair matches your registry credentials - DOCKER_USERNAME: ${{ secrets.QUAY_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.QUAY_PASSWORD }} - DOCKER_REGISTRY: "quay.io" - - # Uncomment and modify the following line with your image name, otherwise no push will happen - IMAGE_NAME: ${{steps.config_quay.outputs.prop}} - - # Lets us monitor disks getting full as images get bigger over time - - name: Show how much disk space is left - run: df -h \ No newline at end of file + uses: eds-book/notebooks-workflows/.github/workflows/build.yaml@main + secrets: + QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} + QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..b5c4304 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,11 @@ +name: MyST GitHub Pages Deploy + +on: + workflow_run: + workflows: ["Execute Notebook"] + branches: [main] + types: [completed] + +jobs: + deploy: + uses: eds-book/notebooks-workflows/.github/workflows/deploy.yaml@main \ No newline at end of file diff --git a/.github/workflows/execute.yaml b/.github/workflows/execute.yaml new file mode 100644 index 0000000..4a6bdf3 --- /dev/null +++ b/.github/workflows/execute.yaml @@ -0,0 +1,11 @@ +name: Execute Notebook + +on: + workflow_run: + workflows: ["Build and push container image"] + branches: [main, postprint] + types: [completed] + +jobs: + execute: + uses: eds-book/notebooks-workflows/.github/workflows/execute.yaml@main \ No newline at end of file diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml deleted file mode 100644 index 21ef3ae..0000000 --- a/.github/workflows/preview.yaml +++ /dev/null @@ -1,74 +0,0 @@ -name: Preview - -on: - workflow_run: - workflows: ["Build and push container image"] - branches: [postprint] - types: [completed] - -# This job installs dependencies, build the jupyter notebook, and pushes it to `preview`, a new `branch` -jobs: - on-success: - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'eds-book-gallery' && github.event.workflow_run.conclusion == 'success' }} - defaults: - run: - shell: bash -l {0} - steps: - - name: Check conditions meet - run: echo 'The triggering workflow passed' - - uses: actions/checkout@v2 - with: - ref: postprint - # Set notebook name - - name: Get properties from the config file - id: config_file - uses: notiz-dev/github-action-json-property@release - with: - path: '.github/config.json' - prop_path: 'notebook_name' - # Set quay image - - name: Get properties from the config file - id: config_quay - uses: notiz-dev/github-action-json-property@release - with: - path: '.github/config.json' - prop_path: 'quay_image' - # Set kernel name - - name: Get properties from the config file - id: config_kernel - uses: notiz-dev/github-action-json-property@release - with: - path: '.github/config.json' - prop_path: 'kernel' - # Render the notebook - - name: Run the build process with Docker - uses: addnab/docker-run-action@v3 - with: - image: quay.io/${{steps.config_quay.outputs.prop}}:latest - options: --user root -v ${{ github.workspace }}:/tmp - shell: bash - run: | - v=$(jupyter kernelspec list | awk '{print $1}' | egrep ${{steps.config_kernel.outputs.prop}}) - jupyter-nbconvert --to notebook --ExecutePreprocessor.kernel_name="$v" --inplace --execute ${{steps.config_file.outputs.prop}} - cp ${{steps.config_file.outputs.prop}} /tmp - - name: Commit - run: | - ls - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git rm \* ':!${{steps.config_file.outputs.prop}}' - git add ${{steps.config_file.outputs.prop}} - git commit -m 'update' - - name: Push - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: preview - force: true - on-failure: - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'eds-book-gallery' && github.event.workflow_run.conclusion == 'failure' }} - steps: - - name: Check conditions meet - run: echo 'The triggering workflow failed' \ No newline at end of file diff --git a/.github/workflows/render.yaml b/.github/workflows/render.yaml deleted file mode 100644 index cde78a4..0000000 --- a/.github/workflows/render.yaml +++ /dev/null @@ -1,71 +0,0 @@ -name: Render - -on: - workflow_run: - workflows: ["Build and push container image"] - branches: main - types: - - completed - -# This job installs dependencies, build the jupyter notebook, and pushes it to `render`, a new `branch` -jobs: - build: - name: ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - if: github.repository_owner == 'eds-book-gallery' - strategy: - fail-fast: false - matrix: - os: ["ubuntu-latest"] - defaults: - run: - shell: bash -l {0} - steps: - - uses: actions/checkout@v2 - # Set notebook name - - name: Get properties from the config file - id: config_file - uses: notiz-dev/github-action-json-property@release - with: - path: '.github/config.json' - prop_path: 'notebook_name' - # Set quay image - - name: Get properties from the config file - id: config_quay - uses: notiz-dev/github-action-json-property@release - with: - path: '.github/config.json' - prop_path: 'quay_image' - # Set kernel name - - name: Get properties from the config file - id: config_kernel - uses: notiz-dev/github-action-json-property@release - with: - path: '.github/config.json' - prop_path: 'kernel' - # Render the notebook - - name: Run the build process with Docker - uses: addnab/docker-run-action@v3 - with: - image: quay.io/${{steps.config_quay.outputs.prop}}:latest - options: --user root -v ${{ github.workspace }}:/tmp - shell: bash - run: | - v=$(jupyter kernelspec list | awk '{print $1}' | egrep ${{steps.config_kernel.outputs.prop}}) - jupyter-nbconvert --to notebook --ExecutePreprocessor.kernel_name="$v" --inplace --execute ${{steps.config_file.outputs.prop}} - cp ${{steps.config_file.outputs.prop}} /tmp - - name: Commit - run: | - ls - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git rm \* ':!${{steps.config_file.outputs.prop}}' - git add ${{steps.config_file.outputs.prop}} - git commit -m 'update' - - name: Push - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: render - force: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 69140db..a4378b6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,40 +5,4 @@ on: jobs: test-build: - runs-on: ubuntu-latest - if: github.repository_owner == 'eds-book-gallery' - steps: - - # For biggish images, github actions runs out of disk space. - # So we cleanup some unwanted things in the disk image, and reclaim that space for our docker use - # https://github.com/actions/virtual-environments/issues/2606#issuecomment-772683150 - # and https://github.com/easimon/maximize-build-space/blob/b4d02c14493a9653fe7af06cc89ca5298071c66e/action.yml#L104 - # This gives us a total of about 52G of free space, which should be enough for now - - name: cleanup disk space - run: | - sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc - df -h - - - name: checkout files in repo - uses: actions/checkout@main - - # Set quay image name - - name: Get properties from the config file - id: config_file - uses: notiz-dev/github-action-json-property@release - with: - path: '.github/config.json' - prop_path: 'quay_image' - - - name: Build the image and push it if `NO_PUSH` disabled - uses: jupyterhub/repo2docker-action@master - with: # make sure username & password/token matches your registry - NO_PUSH: "true" - DOCKER_REGISTRY: "quay.io" - - # Uncomment and modify the following line with your image name. a - IMAGE_NAME: ${{steps.config_quay.outputs.prop}} - - # Lets us monitor disks getting full as images get bigger over time - - name: Show how much disk space is left - run: df -h + uses: eds-book/notebooks-workflows/.github/workflows/test.yaml@main \ No newline at end of file diff --git a/notebook.ipynb b/notebook.ipynb index 83445e8..7d4980c 100644 --- a/notebook.ipynb +++ b/notebook.ipynb @@ -11,19 +11,13 @@ "*Describe the purpose of the use case.*\n", "\n", "### Description\n", - "*Describe the main features of the dataset/sensor, preprocessing, modelling or postprocessing routine*\n", + "*Describe the main features of the dataset/sensor, preprocessing, modelling or postprocessing routine.*\n", "\n", "### Highlights\n", "*Provide 3-5 bullet points that convey the use case’s core procedures. Each bullet point must have a maximum of 85 characters, including spaces.*\n", "* Highlight 1\n", "* Highlight 2\n", "\n", - "### Contributions\n", - "*Please indicate key contributions. Notebook authors (mandatory). Optional subheadings, used in published EDS book notebooks, are Dataset originator/creator, Dataset authors, Dataset documentation, Modelling codebase, Modelling publications, Modelling funding and Pipeline documentation. Feel free to add any of them or propose new ones to attribute relevant research contributions.*\n", - "\n", - "#### Notebook\n", - "* Author (role), Affiliation, GitHub alias\n", - "\n", ":::{note}\n", "*Optional: add credits or acknowledgements to data and/or model providers or authors of code snippets*\n", ":::" @@ -142,8 +136,6 @@ "\n", "**Codebase**: Type here details of codebase version (only for notebooks categorised under modelling/preprocesing/post-processing themes).\n", "\n", - "**License**: The code in this notebook is licensed under the MIT License. The Environmental Data Science book is licensed under the Creative Commons by Attribution 4.0 license. See further details [here](https://github.com/alan-turing-institute/environmental-ds-book/blob/master/LICENSE.md).\n", - "\n", "**Contact**: If you have any suggestion or report an issue with this notebook, feel free to [create an issue](https://github.com/alan-turing-institute/environmental-ds-book/issues/new/choose) or send a direct message to [environmental.ds.book@gmail.com](mailto:environmental.ds.book@gmail.com)." ] }, diff --git a/references.bib b/references.bib new file mode 100644 index 0000000..855af04 --- /dev/null +++ b/references.bib @@ -0,0 +1 @@ +# notebook references in BibTeX format \ No newline at end of file