revert to flattened tutorial folder structure #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
types: [open, synchronize] | |
workflow_dispatch: | |
branches: ["main"] | |
permissions: | |
contents: write | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip==22.3 | |
pip install light-the-torch black black[jupyter] coverage pytest pytest-cov | |
ltt install -e . | |
- name: Lint with Black | |
run: black . | |
- name: Test with pytest | |
run: | | |
pytest --ignore=tests/io --doctest-modules --cov . | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: INFN-PREDATOR/deep-mr | |
readme: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- run: sed -i '/<!-- _README:START -->/,/<!-- _README:END -->/d' README.md | |
- run: echo '<!-- _README:START -->' >> README.md | |
- run: cat _README.md >> README.md | |
- run: echo '<!-- _README:END -->' >> README.md | |
- run: git config --global --add safe.directory /github/workspace | |
- name: pull-request | |
uses: repo-sync/pull-request@v2 | |
with: | |
destination_branch: "main" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: commit | |
run: | | |
git config --global user.email youremail | |
git config --global user.name yourusername | |
git diff --quiet || (git add -A . && git commit -m "README update Automation") | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
docs: | |
runs-on: ubuntu-latest | |
needs: [test, readme] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install dependencies | |
run: | | |
sudo apt-get install pandoc | |
python -m pip install --upgrade pip==22.3 | |
pip install -r docs/requirements.txt | |
ltt install -e . | |
- name: Sphinx build | |
run: | | |
sphinx-build docs/source docs/_build | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3.9.3 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
with: | |
publish_branch: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_build/ | |
force_orphan: true |