Skip to content

Commit 79a2e87

Browse files
committed
Matrix test both 3.10 and 3.11 in CI
1 parent 4c19977 commit 79a2e87

File tree

4 files changed

+30
-22
lines changed

4 files changed

+30
-22
lines changed

.github/workflows/docs.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
name: Build Docs
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
84
workflow_dispatch:
9-
10-
concurrency:
11-
group: docs-deployment-${{ github.ref }}
12-
cancel-in-progress: true
5+
workflow_call:
136

147
jobs:
158
latest-build:
@@ -25,7 +18,7 @@ jobs:
2518
with:
2619
dev: true
2720
python_version: "3.11"
28-
install_args: "--extras async-rediscache"
21+
install_args: "--extras async-rediscache --only main --only doc"
2922

3023
- name: Generate HTML Site
3124
run: sphinx-build -nW -j auto -b html docs docs/build

.github/workflows/lint-test.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
name: Lint & Test
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
9-
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
4+
workflow_call:
125

136
jobs:
147
lint:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
python_version: ["3.10", "3.11"]
1512
name: Run Linting & Test Suites
1613
runs-on: ubuntu-latest
1714
steps:
@@ -20,8 +17,8 @@ jobs:
2017
with:
2118
# Set dev=true to run pre-commit which is a dev dependency
2219
dev: true
23-
python_version: "3.11"
24-
install_args: "--extras async-rediscache"
20+
python_version: ${{ matrix.python_version }}
21+
install_args: "--extras async-rediscache --only main --only lint --only test"
2522

2623
# We will not run `flake8` here, as we will use a separate flake8
2724
# action.
@@ -44,7 +41,7 @@ jobs:
4441
run: python -m pytest -n auto --cov pydis_core -q
4542

4643
- name: Build and dry run the example bot to ensure deps can be installed & imported
47-
run: docker run --rm -it --env GUILD_ID=1234 --env IN_CI=true $(docker build -q -f .\dev\Dockerfile .) run python -m dev.bot
44+
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
4845

4946
# Prepare the Pull Request Payload artifact. If this fails, we
5047
# we fail silently using the `continue-on-error` option. It's

.github/workflows/main.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint-test:
15+
uses: ./.github/workflows/lint-test.yaml
16+
docs:
17+
uses: ./.github/workflows/docs.yaml

dev/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
FROM --platform=linux/amd64 ghcr.io/chrislovering/python-poetry-base:3.10-slim
1+
ARG python_version=3.11
22

3+
FROM --platform=linux/amd64 ghcr.io/chrislovering/python-poetry-base:$python_version-slim
34

45
# Install project dependencies
56
WORKDIR /app
67
COPY pyproject.toml poetry.lock ./
7-
RUN poetry install --no-root --without lint,doc,test
8+
RUN poetry install --no-root --only dev,main
89

910
# Copy the source code in last to optimize rebuilding the image
1011
COPY . .

0 commit comments

Comments
 (0)