diff options
author | 2022-10-26 15:27:16 +0100 | |
---|---|---|
committer | 2022-12-11 13:46:53 +0000 | |
commit | 79a2e875a9ec1fe768bcd3b3c88e49b4d294bd90 (patch) | |
tree | 930b4087edbd2cd8bf00cbdfc0a79dfdddf72646 | |
parent | Add a dry run step to lint & test CI (diff) |
Matrix test both 3.10 and 3.11 in CI
-rw-r--r-- | .github/workflows/docs.yaml | 11 | ||||
-rw-r--r-- | .github/workflows/lint-test.yaml | 19 | ||||
-rw-r--r-- | .github/workflows/main.yaml | 17 | ||||
-rw-r--r-- | dev/Dockerfile | 5 |
4 files changed, 30 insertions, 22 deletions
diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 6d6c9569..03e6bc96 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -1,15 +1,8 @@ name: Build Docs on: - push: - branches: - - main - pull_request: workflow_dispatch: - -concurrency: - group: docs-deployment-${{ github.ref }} - cancel-in-progress: true + workflow_call: jobs: latest-build: @@ -25,7 +18,7 @@ jobs: with: dev: true python_version: "3.11" - install_args: "--extras async-rediscache" + install_args: "--extras async-rediscache --only main --only doc" - name: Generate HTML Site run: sphinx-build -nW -j auto -b html docs docs/build diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 52a3e57a..5d8c1aff 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -1,17 +1,14 @@ name: Lint & Test on: - push: - branches: - - main - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + workflow_call: jobs: lint: + strategy: + fail-fast: false + matrix: + python_version: ["3.10", "3.11"] name: Run Linting & Test Suites runs-on: ubuntu-latest steps: @@ -20,8 +17,8 @@ jobs: with: # Set dev=true to run pre-commit which is a dev dependency dev: true - python_version: "3.11" - install_args: "--extras async-rediscache" + python_version: ${{ matrix.python_version }} + install_args: "--extras async-rediscache --only main --only lint --only test" # We will not run `flake8` here, as we will use a separate flake8 # action. @@ -44,7 +41,7 @@ jobs: run: python -m pytest -n auto --cov pydis_core -q - name: Build and dry run the example bot to ensure deps can be installed & imported - run: docker run --rm -it --env GUILD_ID=1234 --env IN_CI=true $(docker build -q -f .\dev\Dockerfile .) run python -m dev.bot + run: docker run --rm --env GUILD_ID=1234 --env IN_CI=true $(docker build --build-arg python_version=${{ matrix.python_version }} -q -f ./dev/Dockerfile .) run python -m dev.bot # Prepare the Pull Request Payload artifact. If this fails, we # we fail silently using the `continue-on-error` option. It's diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 00000000..62be12e4 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,17 @@ +name: main + +on: + push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint-test: + uses: ./.github/workflows/lint-test.yaml + docs: + uses: ./.github/workflows/docs.yaml diff --git a/dev/Dockerfile b/dev/Dockerfile index aaf275ca..49d03ffd 100644 --- a/dev/Dockerfile +++ b/dev/Dockerfile @@ -1,10 +1,11 @@ -FROM --platform=linux/amd64 ghcr.io/chrislovering/python-poetry-base:3.10-slim +ARG python_version=3.11 +FROM --platform=linux/amd64 ghcr.io/chrislovering/python-poetry-base:$python_version-slim # Install project dependencies WORKDIR /app COPY pyproject.toml poetry.lock ./ -RUN poetry install --no-root --without lint,doc,test +RUN poetry install --no-root --only dev,main # Copy the source code in last to optimize rebuilding the image COPY . . |