Skip to content

BUILD - 2023 PyData Berlin (pull_request) #260

BUILD - 2023 PyData Berlin (pull_request)

BUILD - 2023 PyData Berlin (pull_request) #260

name: "2023 PyData Berlin πŸ‡©πŸ‡ͺ generate gallery.pdf"
run-name: "BUILD - 2023 PyData Berlin (${{ github.event_name }})"
on:
pull_request:
push:
branches:
- main
env:
PYTHON_VERSION: 3.11
defaults:
run:
# Use Bash shell with 'errexit' option to exit immediately if any command fails.
shell: bash -el {0}
jobs:
changes:
name: πŸ”„ Check out changes
runs-on: ubuntu-latest
timeout-minutes: 1
permissions:
pull-requests: read
outputs:
PyDataBerlinChanges: ${{ steps.filter.outputs.PyDataBerlinChanges }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
if: github.ref == 'refs/heads/main' # Only checkout when the branch is 'main'
- name: Check for 2023_PyData_Berlin file changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3.0.2
id: filter
with:
filters: |
PyDataBerlinChanges:
- "2023_PyData_Berlin/**/*.py"
- "2023_PyData_Berlin/**/*.ipynb"
- "2023_PyData_Berlin/requirements.txt"
lint:
name: 🚨 Lint Python code
if: needs.changes.outputs.changes == 'true'
needs: changes
runs-on: ubuntu-latest
steps:
- name: Setup Python environment
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run:
pip install -r 2023_PyData_Berlin/requirements.txt
- name: Run Black
run:
black 2023_PyData_Berlin --check
- name: Run Flake8
run:
flake8 --config 2023_PyData_Berlin/.flake8 2023_PyData_Berlin
test:
name: πŸ•΅ Test Python code
if: ${{ needs.changes.outputs.PyDataBerlinChanges == 'true' }}
needs: changes
runs-on: ubuntu-latest
steps:
- name: Setup Python environment
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run:
pip install -r 2023_PyData_Berlin/requirements.txt
- name: Run tests
run:
pytest 2023_PyData_Berlin
generate-pdf:
runs-on: ubuntu-latest
needs: [ lint, test ]
steps:
- name: Setup Python environment
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run:
pip install -r 2023_PyData_Berlin/requirements.txt
- name: Generate PDF
run:
python 2023_PyData_Berlin/src/assemble_plots.py
- name: Archive PDF
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: gallery.pdf
path: 2023_PyData_Berlin/results/gallery.pdf