From 4da4cbcd2f60884a241fae1030f41b3a81d47189 Mon Sep 17 00:00:00 2001 From: florianvazelle Date: Mon, 21 Aug 2023 21:27:33 +0200 Subject: [PATCH] fix(ci): clean workflows files --- .github/workflows/checks.yml | 27 +++++++++++++++++++++++++++ .github/workflows/nox.yml | 22 ---------------------- .github/workflows/pre-commit.yaml | 20 -------------------- .github/workflows/publish.yml | 25 +++++++++++++++++++++++++ .github/workflows/pypi.yml | 19 ------------------- noxfile.py | 7 +++++++ 6 files changed, 59 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/checks.yml delete mode 100644 .github/workflows/nox.yml delete mode 100644 .github/workflows/pre-commit.yaml create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..e2b9e70 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,27 @@ + +name: Checks + +on: + pull_request: + push: + workflow_dispatch: + +jobs: + checks: + runs-on: ubuntu-latest + strategy: + matrix: + check: ["test", "lint"] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install poetry + uses: abatilo/actions-poetry@v2 + - name: Run nox ${{ matrix.check }} + run: | + poetry install + poetry run nox -rs ${{ matrix.check }} diff --git a/.github/workflows/nox.yml b/.github/workflows/nox.yml deleted file mode 100644 index 17955d8..0000000 --- a/.github/workflows/nox.yml +++ /dev/null @@ -1,22 +0,0 @@ - -name: Nox - -on: - pull_request: - push: - workflow_dispatch: - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Set up Nox - uses: excitedleigh/setup-nox@v2.1.0 - - name: Run nox tests - run: nox -rs test diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml deleted file mode 100644 index 29b3b3e..0000000 --- a/.github/workflows/pre-commit.yaml +++ /dev/null @@ -1,20 +0,0 @@ - -name: Pre-commit - -on: - pull_request: - push: - workflow_dispatch: - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Run pre-commit hooks - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7266218 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ + +name: Publish + +on: + push: + tags: + - "v*.*.*" + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install poetry + uses: abatilo/actions-poetry@v2 + - name: Run nox publish + run: | + poetry install + poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + poetry publish --repository pypi diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml deleted file mode 100644 index 8f184bd..0000000 --- a/.github/workflows/pypi.yml +++ /dev/null @@ -1,19 +0,0 @@ - -name: Pypi - -on: - push: - tags: - - "v*.*.*" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 - with: - pypi_token: ${{ secrets.PYPI_TOKEN }} - python_version: "3.10" - ignore_dev_requirements: "yes" diff --git a/noxfile.py b/noxfile.py index 9991b36..a59d6c0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,6 +1,13 @@ import nox +@nox.session +def lint(session: nox.Session) -> None: + session.install("poetry") + session.run("poetry", "install") + session.run("pre-commit", "run", "-a") + + @nox.session def test(session: nox.Session) -> None: session.install("poetry")