From 62a11c12a8e8c39dafa82178728f556c943323cb Mon Sep 17 00:00:00 2001 From: Rob Aleck Date: Tue, 9 Jul 2024 22:35:36 +0100 Subject: [PATCH] Revert "create single workflow for build, test, publish" --- .devcontainer/devcontainer.json | 4 +- .github/workflows/build_and_publish.yml | 70 ------------------- .github/workflows/codeql.yml | 11 +-- .github/workflows/dependency-review.yml | 3 +- .../{test-workflow.yml => run_pytest.yml} | 22 +++--- poetry.lock | 2 +- pyproject.toml | 8 +-- 7 files changed, 24 insertions(+), 96 deletions(-) delete mode 100644 .github/workflows/build_and_publish.yml rename .github/workflows/{test-workflow.yml => run_pytest.yml} (77%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 410b743..0123613 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,9 +5,7 @@ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", "features": { - "ghcr.io/devcontainers-contrib/features/poetry:2": {}, - "ghcr.io/devcontainers/features/github-cli:1": {} - + "ghcr.io/devcontainers-contrib/features/poetry:2": {} } // Features to add to the dev container. More info: https://containers.dev/features. diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml deleted file mode 100644 index 8b456fd..0000000 --- a/.github/workflows/build_and_publish.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Publish the completed package to Pypi - -on: - push: - branches: - - main - -# permissions: # Global permissions configuration starts here -# contents: read # 'read' access to repository contents -# pull-requests: read # 'write' access to pull requests - -jobs: - codeql: - permissions: - actions: read - contents: read - security-events: write - uses: ./.github/workflows/codeql.yml - - test: - uses: ./.github/workflows/test-workflow.yml - - dependency-review: - uses: ./.github/workflows/dependency-review.yml - - publish: - needs: [test, dependency-review, codeql] - runs-on: ubuntu-latest - environment: - name: 'published' - permissions: # Job-level permissions configuration starts here - contents: write # 'write' access to repository contents - pull-requests: write # 'write' access to pull requests - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b # v1 - with: - version: 1.8.3 # pin the version as they keep changing their APIs - virtualenvs-create: false - virtualenvs-in-project: false - - name: Install dependencies - run: | - python -m venv venv - . venv/bin/activate - poetry install --with dev --no-interaction --sync - python -c "import os; print(os.environ['VIRTUAL_ENV'])" - - name: Bump version - run: | - poetry version minor - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add pyproject.toml - git commit -m "bump version from workflow" - git push origin HEAD:${{ github.head_ref }} - - name: Build - run: poetry build - - name: Use Pypi test - run: | - poetry config repositories.test-pypi https://test.pypi.org/legacy/ - poetry config pypi-token.test-pypi ${{ secrets.PYPI_TOKEN }} - - name: Publish - run: poetry publish -r test-pypi - - \ No newline at end of file diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7463b03..63eae77 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -9,13 +9,14 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: CodeQL +name: "CodeQL" on: - workflow_call: push: - branches-ignore: - - main + branches: ["*", "*/*"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["*", "*/*"] schedule: - cron: "43 4 * * 3" @@ -71,4 +72,4 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3 with: - category: "/language:${{matrix.language}}" + category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index afa0b91..7ab50fd 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -5,8 +5,7 @@ # Source repository: https://github.com/actions/dependency-review-action # Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement name: 'Dependency Review' -on: - workflow_call: +on: [pull_request] permissions: contents: read diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/run_pytest.yml similarity index 77% rename from .github/workflows/test-workflow.yml rename to .github/workflows/run_pytest.yml index 0380f67..94a513b 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/run_pytest.yml @@ -1,15 +1,12 @@ -name: test package +name: Python package on: - workflow_call: push: - branches-ignore: - - main - - -permissions: # Global permissions configuration starts here - contents: read # 'read' access to repository contents - pull-requests: read # 'write' access to pull requests + branches-ignore: + - main + pull_request: + branches: + - main jobs: test: @@ -17,12 +14,17 @@ jobs: matrix: python-version: ["3.12"] runs-on: ubuntu-latest + container: ubuntu:latest@sha256:2e863c44b718727c860746568e1d54afd13b2fa71b160f5cd9058fc436217b30 steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: python-version: ${{ matrix.python-version }} + - name: Install OS dependencies for snok/install-poetry + run: | + DEBIAN_FRONTEND=noninteractive apt update + DEBIAN_FRONTEND=noninteractive apt install curl sqlite3 -y - uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b # v1 with: version: 1.8.3 # pin the version as they keep changing their APIs @@ -48,4 +50,4 @@ jobs: # - name: Upload coverage reports to Codecov # uses: codecov/codecov-action@0cfda1dd0a4ad9efc75517f399d859cd1ea4ced1 # v4 # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index ca523cb..5e12832 100644 --- a/poetry.lock +++ b/poetry.lock @@ -636,4 +636,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "34842efbdeed2743df2ee59132ca8c52bfe471b1fd0eab814be3202ae812d27b" +content-hash = "fde15ee212edd38aa2ee251a58533dcb2022d9ed632c8790602cdad2b3c0bc5f" diff --git a/pyproject.toml b/pyproject.toml index 3d1c49c..a0e1777 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,17 +1,15 @@ [tool.poetry] name = "pydantic-tfl-api" -version = "0.2.0" +version = "0.1.0" description = "A Pydantic-based wrapper for the TfL Unified API https://api.tfl.gov.uk/. Not associated with or endorsed by TfL." authors = ["Rob Aleck "] license = "MIT" readme = "README.md" -homepage = "https://github.com/mnbf9rca/pydantic_tfl_api" -repository = "https://github.com/mnbf9rca/pydantic_tfl_api" [tool.poetry.dependencies] python = "^3.12" -pydantic = ">=2.8.2" -requests = ">=2.32.3" +pydantic = "^2.8.2" +requests = "^2.32.3" [tool.poetry.group.dev.dependencies] black = "^24.4.2"