@@ -79,35 +79,13 @@ jobs:
7979 - name : Checkout
8080 uses : actions/checkout@v6
8181
82- # Prevent running tests on push if there is an open PR for the branch.
83- # This is to avoid duplicate runs on both push and PR events.
84- - name : Detect open PR for branch
85- id : check-pr
86- uses : actions/github-script@v6
87- with :
88- script : |
89- const ref = context.ref;
90- const branch = ref.startsWith('refs/heads/') ? ref.replace('refs/heads/','') : ref;
91- const pulls = await github.rest.pulls.list({
92- owner: context.repo.owner,
93- repo: context.repo.repo,
94- head: `${context.repo.owner}:${branch}`,
95- state: 'open',
96- });
97- if (pulls.data && pulls.data.length > 0) {
98- core.info(`Open PR exists for branch ${branch}, skipping push-run.`);
99- return 'skip';
100- }
101- return 'continue';
102-
10382 - name : Set up Python ${{ matrix.python-version }}
10483 uses : actions/setup-python@v6
10584 with :
10685 python-version : ${{ matrix.python-version }}
10786 cache : " pip"
10887
10988 - name : Install build tools
110- if : ${{ steps.check-pr.outputs.result == 'continue' }}
11189 run : |
11290 pip install --upgrade "pip<24.1" "setuptools>=69.0.0,<=73.0.1"
11391 pip install coverage coveralls
11694 # setuptools<=73.0.1 because https://github.com/pypa/setuptools/issues/4620
11795
11896 - name : Install ICU (macOS)
119- if : ${{ steps.check-pr.outputs.result == 'continue' && startsWith(matrix.os, 'macos-') }}
97+ if : startsWith(matrix.os, 'macos-')
12098 run : |
12199 brew install icu4c
122100 PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig
@@ -126,7 +104,7 @@ jobs:
126104 echo "ICU_VER=${ICU_VER}" >> "${GITHUB_ENV}"
127105
128106 - name : Install PyICU (Windows)
129- if : ${{ steps.check-pr.outputs.result == 'continue' && startsWith(matrix.os, 'windows-') && (matrix.python-version == env.PYTHON_VERSION_LATEST_2 || matrix.python-version == env.PYTHON_VERSION_EARLIEST) }}
107+ if : startsWith(matrix.os, 'windows-') && (matrix.python-version == env.PYTHON_VERSION_LATEST_2 || matrix.python-version == env.PYTHON_VERSION_EARLIEST)
130108 shell : powershell
131109 # Get the wheel URL from https://github.com/cgohlke/pyicu-build/releases
132110 run : |
@@ -136,13 +114,13 @@ jobs:
136114 pip install "$WHEEL_URL"
137115
138116 - name : Install PyThaiNLP + full testing dependencies
139- if : ${{ steps.check-pr.outputs.result == 'continue' && env.INSTALL_FULL_DEPS == 'true' }}
117+ if : env.INSTALL_FULL_DEPS == 'true'
140118 env :
141119 SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL : True
142120 run : pip install ".[full]"
143121
144122 - name : Test (core)
145- if : ${{ steps.check-pr.outputs.result == 'continue' && (( matrix.os == 'ubuntu-latest' && matrix.python-version != env.PYTHON_VERSION_LATEST_2 && matrix.python-version != env.PYTHON_VERSION_EARLIEST) || (matrix.os != 'ubuntu-latest' && matrix.python-version == env.PYTHON_VERSION_LATEST) ) }}
123+ if : ${{ ( matrix.os == 'ubuntu-latest' && matrix.python-version != env.PYTHON_VERSION_LATEST_2 && matrix.python-version != env.PYTHON_VERSION_EARLIEST) || (matrix.os != 'ubuntu-latest' && matrix.python-version == env.PYTHON_VERSION_LATEST) }}
146124 env :
147125 PYTHONIOENCODING : utf-8
148126 run : |
@@ -154,15 +132,15 @@ jobs:
154132 # See also tests/README.md
155133
156134 - name : Test (compact + core)
157- if : ${{ steps.check-pr.outputs.result == 'continue' && ((matrix.python-version == env.PYTHON_VERSION_LATEST_2) || (matrix.python-version == env.PYTHON_VERSION_EARLIEST)) && !(matrix.os == 'ubuntu-latest' && matrix.python-version == env.PYTHON_VERSION_LATEST_2) }}
135+ if : ${{ ((matrix.python-version == env.PYTHON_VERSION_LATEST_2) || (matrix.python-version == env.PYTHON_VERSION_EARLIEST)) && !(matrix.os == 'ubuntu-latest' && matrix.python-version == env.PYTHON_VERSION_LATEST_2) }}
158136 env :
159137 PYTHONIOENCODING : utf-8
160138 run : |
161139 pip install ".[compact]"
162140 python -m unittest tests.core tests.compact
163141
164142 - name : Test (extra + compact + core)
165- if : ${{ steps.check-pr.outputs.result == 'continue' && matrix.os == 'ubuntu-latest' && matrix.python-version == env.PYTHON_VERSION_LATEST_2 }}
143+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == env.PYTHON_VERSION_LATEST_2
166144 env :
167145 PYTHONIOENCODING : utf-8
168146 run : |
@@ -171,7 +149,7 @@ jobs:
171149
172150 # Only submit a report from the "extra" run, to get maximum coverage
173151 - name : Coverage report
174- if : ${{ steps.check-pr.outputs.result == 'continue' && matrix.os == 'ubuntu-latest' && matrix.python-version == env.PYTHON_VERSION_LATEST_2 }}
152+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == env.PYTHON_VERSION_LATEST_2
175153 env :
176154 COVERALLS_SERVICE_NAME : github
177155 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments