Update #40
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: Update | |
on: | |
workflow_dispatch: | |
schedule: | |
# Every Monday, 7:30 AM (Berlin) | |
- cron: "30 5 * * 1" | |
# Artifacts' retention is 5 days, and stalebot.yml marks as stale and closes PRs after 3+2 days | |
# These jobs are re-run weekly anyway, so if PRs are unnattended the package.json and requirements.txt | |
# files will receive same updates again in a week. | |
jobs: | |
python: | |
env: | |
UV_SYSTEM_PYTHON: 1 | |
if: github.repository == 'maxplanck-ie/parkour2' | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: ['3.10', 3.11, 3.12, 3.13] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up UV for py ${{ matrix.python-version }} | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "backend/requirements/**/*.txt" | |
- name: Backend Update | |
run: | | |
export this=backend/requirements/${{ matrix.python-version }} | |
mkdir -p $this | |
uv pip compile --no-progress --universal --python-version ${{ matrix.python-version }} \ | |
backend/requirements/base.in -o ${this}/base.txt | |
uv pip compile --no-progress --universal --python-version ${{ matrix.python-version }} \ | |
backend/requirements/dev.in -c ${this}/base.txt -o ${this}/dev.txt | |
uv pip compile --no-progress --universal --python-version ${{ matrix.python-version }} \ | |
backend/requirements/testing.in -c ${this}/dev.txt -o ${this}/testing.txt | |
- name: Test installation | |
run: uv pip install -r backend/requirements/${{ matrix.python-version }}/testing.txt | |
- name: Upload Python requirements | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-requirements-${{ matrix.python-version }} | |
path: backend/requirements/${{ matrix.python-version }} | |
retention-days: 5 | |
vuejs: | |
if: github.repository == 'maxplanck-ie/parkour2' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Frontend Update | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'frontend/package.json' | |
- run: npm install -g npm-check-updates | |
- run: cd frontend && ncu -u | |
- name: Upload VueJS package.json | |
uses: actions/upload-artifact@v4 | |
with: | |
name: package-json | |
path: frontend/package.json | |
retention-days: 5 | |
create-pr: | |
needs: [python, vuejs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download VueJS package.json | |
uses: actions/download-artifact@v4 | |
with: | |
name: package-json | |
path: frontend/ | |
- name: Download Python requirements | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: python-requirements-* | |
path: temp/ | |
- name: Move Python requirements to correct location | |
run: | | |
for version in $(find temp/ -maxdepth 1 -type d -name "python-requirements-*" | sed 's/.*python-requirements-//'); do | |
mkdir -p backend/requirements/${version} | |
mv temp/python-requirements-${version}/* backend/requirements/${version}/ | |
done | |
- name: Create Combined PR | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
branch: update/dependencies | |
title: Update dependencies | |
body: | | |
Update all frontend and backend dependencies. | |
- Backend: Updated Python dependencies for all supported versions | |
- Frontend: Updated Node.js dependencies | |
delete-branch: true | |
labels: | | |
Dependencies | |
commit-message: | | |
Update all dependencies | |
- Backend: Run of `uv pip compile` to update all python dependencies | |
- Frontend: Run of `npm-check-updates` to update all node dependencies |