From 5ca70e57a13a0e302fc461c717d1549bd9091934 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 25 Oct 2022 21:56:39 +0100 Subject: Support 3.11 and bump CI to use 3.11 --- .github/workflows/docs.yaml | 8 ++++---- .github/workflows/lint-test.yaml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 372a2b8f..6d6c9569 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -21,10 +21,10 @@ jobs: - uses: actions/checkout@v2 - name: Install Python Dependencies - uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1 + uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.2 with: dev: true - python_version: "3.10" + python_version: "3.11" install_args: "--extras async-rediscache" - name: Generate HTML Site @@ -46,10 +46,10 @@ jobs: fetch-depth: 0 # We need to check out the entire repository to find all tags - name: Install Python Dependencies - uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1 + uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.2 with: dev: true - python_version: "3.10" + python_version: "3.11" install_args: "--extras async-rediscache" - name: Build All Doc Versions diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index dc83086b..222deb24 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -16,11 +16,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Python Dependencies - uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1 + uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.2 with: # Set dev=true to run pre-commit which is a dev dependency dev: true - python_version: "3.10" + python_version: "3.11" install_args: "--extras async-rediscache" # We will not run `flake8` here, as we will use a separate flake8 -- cgit v1.2.3 From 4c1997790a2b0ee295bfe6909570f888ad82db8c Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Wed, 26 Oct 2022 15:22:36 +0100 Subject: Add a dry run step to lint & test CI --- .github/workflows/lint-test.yaml | 3 +++ dev/bot/__main__.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 222deb24..52a3e57a 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -43,6 +43,9 @@ jobs: - name: Run tests and generate coverage report 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 + # Prepare the Pull Request Payload artifact. If this fails, we # we fail silently using the `continue-on-error` option. It's # nice if this succeeds, but if it fails for any reason, it diff --git a/dev/bot/__main__.py b/dev/bot/__main__.py index 1b1a551a..e28be36b 100644 --- a/dev/bot/__main__.py +++ b/dev/bot/__main__.py @@ -31,4 +31,5 @@ async def main() -> None: async with bot: await bot.start(os.getenv("BOT_TOKEN")) -asyncio.run(main()) +if os.getenv("IN_CI", "").lower() != "true": + asyncio.run(main()) -- cgit v1.2.3 From 79a2e875a9ec1fe768bcd3b3c88e49b4d294bd90 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Wed, 26 Oct 2022 15:27:16 +0100 Subject: Matrix test both 3.10 and 3.11 in CI --- .github/workflows/docs.yaml | 11 ++--------- .github/workflows/lint-test.yaml | 19 ++++++++----------- .github/workflows/main.yaml | 17 +++++++++++++++++ dev/Dockerfile | 5 +++-- 4 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/main.yaml (limited to '.github/workflows') 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 . . -- cgit v1.2.3