diff --git a/.github/workflows/notebook.yml b/.github/workflows/notebook.yml new file mode 100644 index 000000000..37f8ff197 --- /dev/null +++ b/.github/workflows/notebook.yml @@ -0,0 +1,93 @@ +## +## Copyright (c) 2022 TUM Department of Electrical and Computer Engineering. +## +## This file is part of MLonMCU. +## See https://github.com/tum-ei-eda/mlonmcu.git for further info. +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## +name: Run Notebook +on: + push: + branches: + - develop + workflow_dispatch: + inputs: + path: + description: 'Notebook search path' + required: true + default: "Examples/" + branch: + description: 'Target branch for updates' + required: false + default: "" + +jobs: + run: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + # TODO: caching + - name: Install APT packages + run: | + sudo apt -qq install -y g++ libboost-all-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev graphviz doxygen libtinfo-dev zlib1g-dev texinfo unzip device-tree-compiler pandoc + sudo apt -qq install -y ninja-build flex + sudo apt remove clang-11* llvm-11* + - name: Run Notebooks + run: | + cd ipynb + # find ${{ github.event.inputs.path }} -name '*.ipynb' -exec ./run_notebook.sh {} \; + find Examples/AnalyseInstructionsFeature -name '*.ipynb' -exec ./run_notebook.sh {} \; + - name: Archive reports + uses: actions/upload-artifact@v2 + with: + name: output + path: | + ipynb/**/*.ipynb + ipynb/**/*.html + ipynb/**/*.pdf + - name: Get date + run: echo "timestamp=`date +%FT%T`" >> $GITHUB_ENV + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + # if: github.event_name == 'workflow_dispatch' && github.event.inputs.branch != '' + with: + # token: ${{ secrets.PAT }} + commit-message: Update Notebook Outputs for ${{ github.event.inputs.path }} on ${{ env.timestamp }} + committer: GitHub + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + signoff: false + # branch: ${{ github.event.inputs.branch }} + branch: pr-ipynb + delete-branch: true + title: '[ipynb] Update Notebook Ouputs' + body: | + Affected Paths: ${{ github.event.inputs.path }} + Timestamp: ${{ env.timestamp }} + + Auto-generated by [create-pull-request][1] + + [1]: https://github.com/peter-evans/create-pull-request + add-paths: | + ipynb/*.ipynb + assignees: philippvk + reviewers: philippvk