diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 919e5c8f..ea78321f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,11 +7,29 @@ on: branches: ["*"] jobs: + determine_version: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - id: set-matrix + run: | + if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref }}" == 'refs/heads/master' ]]; then + # Push to master branch + echo 'matrix=["3.7", "3.9", "3.10", "3.11"]' >> $GITHUB_OUTPUT + elif [[ "${{ github.event_name }}" == 'pull_request' && "${{ github.event.pull_request.base.ref }}" == 'master' ]]; then + # PR to master branch + echo 'matrix=["3.7", "3.9", "3.10", "3.11"]' >> $GITHUB_OUTPUT + else + echo 'matrix=["3.9"]' >> $GITHUB_OUTPUT + fi + build: + needs: determine_version strategy: matrix: platform: [ubuntu-latest] - python-version: [3.7, 3.9] + python-version: ${{fromJson(needs.determine_version.outputs.matrix)}} runs-on: ${{ matrix.platform }} diff --git a/hed/models/base_input.py b/hed/models/base_input.py index 9f437102..58bb94c9 100644 --- a/hed/models/base_input.py +++ b/hed/models/base_input.py @@ -137,7 +137,7 @@ def _indexed_dict_from_onsets(onsets): @staticmethod def _filter_by_index_list(original_series, indexed_dict): - new_series = pd.Series(["n/a"] * len(original_series)) + new_series = pd.Series(["n/a"] * len(original_series), dtype=str) for onset, indices in indexed_dict.items(): if indices: diff --git a/tests/models/test_base_input.py b/tests/models/test_base_input.py index 71e21386..02c7f34a 100644 --- a/tests/models/test_base_input.py +++ b/tests/models/test_base_input.py @@ -304,7 +304,7 @@ def test_complex_onsets(self): {3.5: [0, 1], 4.0: [2], 4.4: [3, 4], -1.0: [5]}) def test_empty_and_single_item_series(self): - self.assertTrue(BaseInput._filter_by_index_list(pd.Series([]), {}).equals(pd.Series([]))) + self.assertTrue(BaseInput._filter_by_index_list(pd.Series([], dtype=str), {}).equals(pd.Series([], dtype=str))) self.assertTrue(BaseInput._filter_by_index_list(pd.Series(["apple"]), {0: [0]}).equals(pd.Series(["apple"]))) def test_two_item_series_with_same_onset(self):