Skip to content

Commit

Permalink
Improve github CIs (#182)
Browse files Browse the repository at this point in the history
* run publish on 3.11 and check befor eupload

* run stubs on 3.11

* make dataset caching DRY
  • Loading branch information
mscheltienne authored May 30, 2024
1 parent 16b9e42 commit 02d0bc1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 34 deletions.
22 changes: 22 additions & 0 deletions .github/actions/get-testing-dataset/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Get MNE testing dataset"
description: "A composite action to get MNE testing dataset from cache or remote."

runs:
using: "composite"
steps:
- name: Get testing dataset version
shell: bash
run: curl https://raw.githubusercontent.com/mne-tools/mne-testing-data/master/version.txt -o mne_testing_data_version.txt
- name: Cache testing dataset
id: cache
uses: actions/cache@v4
with:
key: mne-testing-${{ runner.os }}-${{ hashFiles('mne_testing_data_version.txt') }}
path: ~/mne_data
- name: Download testing dataset
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: python -c "import mne; mne.datasets.testing.data_path(verbose=True)"
- name: Remove dataset version file
shell: bash
run: rm mne_testing_data_version.txt
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python 3.9
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --progress-bar off --upgrade pip setuptools
Expand All @@ -31,4 +30,5 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m build
twine check dist/*
twine upload dist/*
32 changes: 4 additions & 28 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,8 @@ jobs:
run: pycrostates-sys_info --developer
- name: Display MNE info
run: mne sys_info -pd
- name: Get testing dataset version
run: |
curl https://raw.githubusercontent.com/mne-tools/mne-testing-data/master/version.txt -o mne_testing_data_version.txt
- name: Cache testing dataset
id: cache
uses: actions/cache@v4
with:
key: mne-testing-${{ runner.os }}-${{ hashFiles('mne_testing_data_version.txt') }}
path: ~/mne_data
- name: Download testing dataset
if: steps.cache.outputs.cache-hit != 'true'
run: python -c "import mne; mne.datasets.testing.data_path(verbose=True)"
- name: Remove dataset version file
run: rm mne_testing_data_version.txt
- name: Get testing dataset
uses: ./.github/actions/get-testing-dataset
- name: Run pytest
run: pytest pycrostates --cov=pycrostates --cov-report=xml --cov-config=pyproject.toml
- name: Upload to codecov
Expand Down Expand Up @@ -93,20 +81,8 @@ jobs:
run: pycrostates-sys_info --developer
- name: Display MNE info
run: mne sys_info -pd
- name: Get testing dataset version
run: |
curl https://raw.githubusercontent.com/mne-tools/mne-testing-data/master/version.txt -o mne_testing_data_version.txt
- name: Cache testing dataset
id: cache
uses: actions/cache@v4
with:
key: mne-testing-${{ runner.os }}-${{ hashFiles('mne_testing_data_version.txt') }}
path: ~/mne_data
- name: Download testing dataset
if: steps.cache.outputs.cache-hit != 'true'
run: python -c "import mne; mne.datasets.testing.data_path(verbose=True)"
- name: Remove dataset version file
run: rm mne_testing_data_version.txt
- name: Get testing dataset
uses: ./.github/actions/get-testing-dataset
- name: Run pytest
run: pytest pycrostates --cov=pycrostates --cov-report=xml --cov-config=pyproject.toml
- name: Upload to codecov
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/stubs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python 3.9
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: 'x64'
python-version: 3.11
- name: Install package
run: |
python -m pip install --progress-bar off --upgrade pip setuptools
Expand Down

0 comments on commit 02d0bc1

Please sign in to comment.