Skip to content

Commit 99a3861

Browse files
Push
1 parent d81266e commit 99a3861

File tree

4 files changed

+186
-9
lines changed

4 files changed

+186
-9
lines changed

.github/setup/action.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: Install project dependencies
2+
description: Install project dependencies
23

34
inputs:
45
python-version:
6+
description: The python version to use
57
required: true
68
os:
7-
required: true
8-
numpy-version:
9+
description: The OS to run on
910
required: true
1011

1112
runs:
1213
using: composite
1314
steps:
14-
1515
- name: Set up Python
16-
uses: actions/setup-python@v4
16+
uses: actions/setup-python@v5
1717
with:
1818
python-version: ${{ inputs.python-version }}
1919

@@ -27,15 +27,11 @@ runs:
2727
id: poetry_version
2828

2929
- name: Cache poetry.lock
30-
uses: actions/cache@v3
30+
uses: actions/cache@v4
3131
with:
3232
path: poetry.lock
3333
key: ${{ inputs.os }}-${{ inputs.python-version }}-poetry-${{ steps.poetry_version.outputs.VERSION }}-${{ hashFiles('pyproject.toml') }}
3434

3535
- name: Install project dependencies
3636
shell: bash
3737
run: poetry install -vvv --no-root
38-
39-
- name: Set numpy version
40-
shell: bash
41-
run: pip install numpy"${{ inputs. numpy-version }}"
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Comment Commands to Trigger CI
2+
on:
3+
issue_comment:
4+
types: created
5+
6+
permissions:
7+
checks: write
8+
9+
env:
10+
# store mapping of commands to use with poetry
11+
RUN_COMMAND: '{"/pandas_nightly": "pytest --nightly", "/pyright_strict": "pyright_strict", "/mypy_nightly": "mypy --mypy_nightly"}'
12+
# store mapping of labels to display in the check runs
13+
DISPLAY_COMMAND: '{"/pandas_nightly": "Pandas nightly tests", "/pyright_strict": "Pyright strict tests", "/mypy_nightly": "Mypy nightly tests"}'
14+
15+
jobs:
16+
optional_tests:
17+
name: "Optional tests run"
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 10
20+
# if more commands are added, they will need to be added here too as we don't have access to env at this stage
21+
if: (github.event.issue.pull_request) && contains(fromJSON('["/pandas_nightly", "/pyright_strict", "/mypy_nightly"]'), github.event.comment.body)
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Install project dependencies
27+
uses: ./.github/setup
28+
with:
29+
os: ubuntu-latest
30+
python-version: "3.11"
31+
32+
- name: Run ${{ fromJSON(env.DISPLAY_COMMAND)[github.event.comment.body] }}
33+
# run the tests based on the value of the comment
34+
id: tests-step
35+
run: poetry run poe ${{ fromJSON(env.RUN_COMMAND)[github.event.comment.body] }}
36+
37+
- name: Get head sha and store value
38+
# get the sha of the last commit to attach the results of the tests
39+
if: always()
40+
id: get-sha
41+
uses: actions/github-script@v7
42+
with:
43+
github-token: ${{ secrets.GITHUB_TOKEN }}
44+
script: |
45+
const pr = await github.rest.pulls.get({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
pull_number: ${{ github.event.issue.number }}
49+
})
50+
core.setOutput('sha', pr.data.head.sha)
51+
52+
- name: Report results of the tests and publish
53+
# publish the results to a check run no matter the pass or fail
54+
if: always()
55+
uses: actions/github-script@v7
56+
with:
57+
github-token: ${{ secrets.GITHUB_TOKEN }}
58+
script: |
59+
github.rest.checks.create({
60+
name: '${{ fromJSON(env.DISPLAY_COMMAND)[github.event.comment.body] }}',
61+
head_sha: '${{ steps.get-sha.outputs.sha }}',
62+
status: 'completed',
63+
conclusion: '${{ steps.tests-step.outcome }}',
64+
output: {
65+
title: 'Run ${{ fromJSON(env.DISPLAY_COMMAND)[github.event.comment.body] }}',
66+
summary: 'Results: ${{ steps.tests-step.outcome }}',
67+
text: 'See the actions run at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}',
68+
},
69+
owner: context.repo.owner,
70+
repo: context.repo.repo
71+
})

.github/workflows/optional.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 'Optional'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
nightly:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Install project dependencies
18+
uses: ./.github/setup
19+
with:
20+
os: ubuntu-latest
21+
python-version: '3.11'
22+
23+
- name: Run pytest (against pandas nightly)
24+
run: poetry run poe pytest --nightly
25+
26+
mypy_nightly:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 10
29+
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Install project dependencies
34+
uses: ./.github/setup
35+
with:
36+
os: ubuntu-latest
37+
python-version: '3.11'
38+
39+
- name: Run mypy tests with mypy nightly
40+
run: poetry run poe mypy --mypy_nightly
41+
42+
pyright_strict:
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 10
45+
46+
steps:
47+
- uses: actions/checkout@v3
48+
49+
- name: Install project dependencies
50+
uses: ./.github/setup
51+
with:
52+
os: ubuntu-latest
53+
python-version: '3.11'
54+
55+
- name: Run pyright tests with full strict mode
56+
run: poetry run poe pyright_strict

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Test"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
MPLBACKEND: "Agg"
12+
13+
jobs:
14+
released:
15+
runs-on: ${{ matrix.os }}
16+
timeout-minutes: 20
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
# macos-latest is arm
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
python-version: ["3.10", "3.11", "3.12"]
23+
24+
name: OS ${{ matrix.os }} - Python ${{ matrix.python-version }}
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Install project dependencies
30+
uses: ./.github/setup
31+
with:
32+
os: ${{ matrix.os }}
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Run mypy on 'tests' (using the local stubs) and on the local stubs
36+
run: poetry run poe mypy
37+
38+
- name: Run pyright on 'tests' (using the local stubs) and on the local stubs
39+
run: poetry run poe pyright
40+
41+
- name: Run pytest
42+
run: poetry run poe pytest
43+
44+
- name: Install pandas-stubs and run tests on the installed stubs
45+
run: poetry run poe test_dist
46+
47+
precommit:
48+
runs-on: ubuntu-latest
49+
timeout-minutes: 10
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- uses: pre-commit/[email protected]

0 commit comments

Comments
 (0)