Skip to content

Commit 25d689a

Browse files
authored
MAINT switch CI to use pixi and Github Actions(#1098)
1 parent 980cc94 commit 25d689a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+23029
-1303
lines changed

.coveragerc

+5-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
1-
# Configuration for coverage.py
2-
31
[run]
42
branch = True
5-
source = imblearn
6-
include = */imblearn/*
7-
omit =
8-
*/setup.py
93

104
[report]
115
exclude_lines =
12-
pragma: no cover
13-
def __repr__
146
if self.debug:
15-
if settings.DEBUG
16-
raise AssertionError
7+
pragma: no cover
178
raise NotImplementedError
18-
if 0:
19-
if __name__ == .__main__.:
20-
if self.verbose:
21-
show_missing = True
9+
ignore_errors = True
10+
omit =
11+
*/tests/*
12+
**/setup.py

.flake8

-8
This file was deleted.

.github/ISSUE_TEMPLATE/other--blank-template-.md

-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ labels: ''
66
assignees: ''
77

88
---
9-
10-

.github/check-changelog.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Check Changelog
2+
# This check makes sure that the changelog is properly updated
3+
# when a PR introduces a change in a test file.
4+
# To bypass this check, label the PR with "No Changelog Needed".
5+
on:
6+
pull_request:
7+
types: [opened, edited, labeled, unlabeled, synchronize]
8+
9+
jobs:
10+
check:
11+
name: A reviewer will let you know if it is required or can be bypassed
12+
runs-on: ubuntu-latest
13+
if: ${{ contains(github.event.pull_request.labels.*.name, 'No Changelog Needed') == 0 }}
14+
steps:
15+
- name: Get PR number and milestone
16+
run: |
17+
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
18+
echo "TAGGED_MILESTONE=${{ github.event.pull_request.milestone.title }}" >> $GITHUB_ENV
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: '0'
22+
- name: Check the changelog entry
23+
run: |
24+
set -xe
25+
changed_files=$(git diff --name-only origin/main)
26+
# Changelog should be updated only if tests have been modified
27+
if [[ ! "$changed_files" =~ tests ]]
28+
then
29+
exit 0
30+
fi
31+
all_changelogs=$(cat ./doc/whats_new/v*.rst)
32+
if [[ "$all_changelogs" =~ :pr:\`$PR_NUMBER\` ]]
33+
then
34+
echo "Changelog has been updated."
35+
# If the pull request is milestoned check the correspondent changelog
36+
if exist -f ./doc/whats_new/v${TAGGED_MILESTONE:0:4}.rst
37+
then
38+
expected_changelog=$(cat ./doc/whats_new/v${TAGGED_MILESTONE:0:4}.rst)
39+
if [[ "$expected_changelog" =~ :pr:\`$PR_NUMBER\` ]]
40+
then
41+
echo "Changelog and milestone correspond."
42+
else
43+
echo "Changelog and milestone do not correspond."
44+
echo "If you see this error make sure that the tagged milestone for the PR"
45+
echo "and the edited changelog filename properly match."
46+
exit 1
47+
fi
48+
fi
49+
else
50+
echo "A Changelog entry is missing."
51+
echo ""
52+
echo "Please add an entry to the changelog at 'doc/whats_new/v*.rst'"
53+
echo "to document your change assuming that the PR will be merged"
54+
echo "in time for the next release of imbalanced-learn."
55+
echo ""
56+
echo "Look at other entries in that file for inspiration and please"
57+
echo "reference this pull request using the ':pr:' directive and"
58+
echo "credit yourself (and other contributors if applicable) with"
59+
echo "the ':user:' directive."
60+
echo ""
61+
echo "If you see this error and there is already a changelog entry,"
62+
echo "check that the PR number is correct."
63+
echo ""
64+
echo "If you believe that this PR does not warrant a changelog"
65+
echo "entry, say so in a comment so that a maintainer will label"
66+
echo "the PR with 'No Changelog Needed' to bypass this check."
67+
exit 1
68+
fi

.github/dependabot.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions as recommended in SPEC8:
4+
# https://github.com/scientific-python/specs/pull/325
5+
# At the time of writing, release critical workflows such as
6+
# pypa/gh-action-pypi-publish should use hash-based versioning for security
7+
# reasons. This strategy may be generalized to all other github actions
8+
# in the future.
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
groups:
14+
actions:
15+
patterns:
16+
- "*"
17+
reviewers:
18+
- "glemaitre"
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
1-
name: circleci-artifacts-redirector
1+
name: CircleCI artifacts redirector
22

33
on: [status]
4+
5+
# Restrict the permissions granted to the use of secrets.GITHUB_TOKEN in this
6+
# github actions workflow:
7+
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication
8+
permissions:
9+
statuses: write
10+
411
jobs:
512
circleci_artifacts_redirector_job:
613
runs-on: ubuntu-latest
14+
# For testing this action on a fork, remove the "github.repository =="" condition.
15+
if: "github.repository == 'scikit-learn-contrib/imbalanced-learn' && github.event.context == 'ci/circleci: doc'"
716
name: Run CircleCI artifacts redirector
817
steps:
918
- name: GitHub Action step
10-
uses: larsoner/circleci-artifacts-redirector-action@master
19+
uses: scientific-python/circleci-artifacts-redirector-action@v1
1120
with:
1221
repo-token: ${{ secrets.GITHUB_TOKEN }}
13-
artifact-path: doc/index.html
14-
circleci-jobs: documentation
22+
api-token: ${{ secrets.CIRCLE_CI }}
23+
artifact-path: 0/doc/index.html
24+
circleci-jobs: doc
25+
job-title: Check the rendered docs here!

.github/workflows/linters.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Run code format checks
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
run-pre-commit-checks:
13+
name: Run pre-commit checks
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: prefix-dev/[email protected]
19+
with:
20+
pixi-version: v0.31.0
21+
frozen: true
22+
23+
- name: Run tests
24+
run: pixi run -e linters linters

.github/workflows/tests.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'tests'
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
test:
13+
strategy:
14+
matrix:
15+
os: [windows-latest, ubuntu-latest, macos-latest]
16+
environment: [
17+
ci-py310-min-dependencies,
18+
ci-py310-min-optional-dependencies,
19+
ci-py310-min-keras,
20+
ci-py310-min-tensorflow,
21+
ci-py311-sklearn-1-3,
22+
ci-py311-sklearn-1-4,
23+
ci-py311-latest-keras,
24+
ci-py311-latest-tensorflow,
25+
ci-py312-latest-dependencies,
26+
ci-py312-latest-optional-dependencies,
27+
]
28+
exclude:
29+
- os: windows-latest
30+
environment: ci-py310-min-keras
31+
- os: windows-latest
32+
environment: ci-py310-min-tensorflow
33+
- os: windows-latest
34+
environment: ci-py311-latest-keras
35+
- os: windows-latest
36+
environment: ci-py311-latest-tensorflow
37+
runs-on: ${{ matrix.os }}
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: prefix-dev/[email protected]
41+
with:
42+
pixi-version: v0.31.0
43+
environments: ${{ matrix.environment }}
44+
# we can freeze the environment and manually bump the dependencies to the
45+
# latest version time to time.
46+
frozen: true
47+
48+
- name: Run tests
49+
run: pixi run -e ${{ matrix.environment }} tests -n 3
50+
51+
- name: Upload coverage reports to Codecov
52+
uses: codecov/[email protected]
53+
with:
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
slug: scikit-learn-contrib/imbalanced-learn

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,10 @@ doc/min_dependency_table.rst
127127

128128
# MacOS
129129
.DS_Store
130+
131+
# Pixi folder
132+
.pixi/
133+
134+
# Generated files
135+
doc/min_dependency_substitutions.rst
136+
doc/sg_execution_times.rst

.pre-commit-config.yaml

+5-11
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@ repos:
55
- id: check-yaml
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
8-
- repo: https://github.com/psf/black
9-
rev: 23.3.0
10-
hooks:
11-
- id: black
128
- repo: https://github.com/astral-sh/ruff-pre-commit
139
# Ruff version.
14-
rev: v0.0.272
10+
rev: v0.4.8
1511
hooks:
1612
- id: ruff
17-
args: ["--fix", "--show-source"]
18-
- repo: https://github.com/pre-commit/mirrors-mypy
19-
rev: v1.3.0
13+
args: ["--fix", "--output-format=full"]
14+
- repo: https://github.com/psf/black
15+
rev: 23.3.0
2016
hooks:
21-
- id: mypy
22-
files: imblearn/
23-
additional_dependencies: [pytest==6.2.4]
17+
- id: black

Makefile

-35
This file was deleted.

README.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@
2727
.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
2828
.. _Black: :target: https://github.com/psf/black
2929

30-
.. |PythonMinVersion| replace:: 3.8
31-
.. |NumPyMinVersion| replace:: 1.17.3
32-
.. |SciPyMinVersion| replace:: 1.5.0
33-
.. |ScikitLearnMinVersion| replace:: 1.0.2
34-
.. |MatplotlibMinVersion| replace:: 3.1.2
35-
.. |PandasMinVersion| replace:: 1.0.5
36-
.. |TensorflowMinVersion| replace:: 2.4.3
37-
.. |KerasMinVersion| replace:: 2.4.3
38-
.. |SeabornMinVersion| replace:: 0.9.0
39-
.. |PytestMinVersion| replace:: 5.0.1
30+
.. |PythonMinVersion| replace:: 3.10
31+
.. |NumPyMinVersion| replace:: 1.24.3
32+
.. |SciPyMinVersion| replace:: 1.10.1
33+
.. |ScikitLearnMinVersion| replace:: 1.2.2
34+
.. |MatplotlibMinVersion| replace:: 3.7.3
35+
.. |PandasMinVersion| replace:: 1.5.3
36+
.. |TensorflowMinVersion| replace:: 2.13.1
37+
.. |KerasMinVersion| replace:: 3.0.5
38+
.. |SeabornMinVersion| replace:: 0.12.2
39+
.. |PytestMinVersion| replace:: 7.2.2
4040

4141
imbalanced-learn
4242
================

0 commit comments

Comments
 (0)