mirror of
https://github.com/Crocmagnon/charasheet.git
synced 2024-11-05 14:23:53 +01:00
Add workflow to update dependencies
This commit is contained in:
parent
b617128d7f
commit
9b7baa6b77
2 changed files with 47 additions and 4 deletions
36
.github/workflows/update-dependencies.yaml
vendored
Normal file
36
.github/workflows/update-dependencies.yaml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
name: Update dependencies
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
ref: master
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
cache: pip
|
||||||
|
- name: Update dependencies
|
||||||
|
run: |
|
||||||
|
pip install pip-tools invoke
|
||||||
|
invoke update-dependencies --no-sync
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PERSONAL_TOKEN_PR }}
|
||||||
|
commit-message: Update dependencies
|
||||||
|
base: master
|
||||||
|
branch: update-dependencies
|
||||||
|
title: Update dependencies
|
||||||
|
delete-branch: true
|
15
tasks.py
15
tasks.py
|
@ -10,7 +10,12 @@ TEST_ENV = {"ENV_FILE": BASE_DIR / "envs" / "test-envs.env"}
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def sync_dependencies(ctx: Context, *, update: bool = False):
|
def update_dependencies(ctx: Context, *, sync: bool = True):
|
||||||
|
return compile_dependencies(ctx, update=True, sync=sync)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def compile_dependencies(ctx: Context, *, update: bool = False, sync: bool = False):
|
||||||
common_args = "-q --allow-unsafe --resolver=backtracking"
|
common_args = "-q --allow-unsafe --resolver=backtracking"
|
||||||
if update:
|
if update:
|
||||||
common_args += " --upgrade"
|
common_args += " --upgrade"
|
||||||
|
@ -30,12 +35,14 @@ def sync_dependencies(ctx: Context, *, update: bool = False):
|
||||||
pty=True,
|
pty=True,
|
||||||
echo=True,
|
echo=True,
|
||||||
)
|
)
|
||||||
ctx.run("pip-sync requirements.txt requirements-dev.txt", pty=True, echo=True)
|
if sync:
|
||||||
|
sync_dependencies(ctx)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def update_dependencies(ctx: Context):
|
def sync_dependencies(ctx: Context):
|
||||||
return sync_dependencies(ctx, update=True)
|
with ctx.cd(BASE_DIR):
|
||||||
|
ctx.run("pip-sync requirements.txt requirements-dev.txt", pty=True, echo=True)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
|
|
Loading…
Reference in a new issue