Use sklearn 1.4 or above #1090
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Publish | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
# Build the package | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.9' | |
- name: Install poetry | |
uses: Gr1N/setup-poetry@v8 | |
- name: Build package | |
run: poetry build | |
- name: Upload built package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
retention-days: 1 | |
# Run pytest using built package | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ["3.9", "3.10"] | |
group: [1, 2, 3, 4, 5] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: 'pip' | |
cache-dependency-path: "poetry.lock" | |
- name: Download built package | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
- name: Install summit and pytest | |
shell: bash | |
run: | | |
WHL_NAME=$(ls summit-*.whl) | |
pip install ${WHL_NAME}[experiments,entmoot] pytest pytest-split | |
- name: Run tests | |
shell: bash | |
run: PY_IGNORE_IMPORTMISMATCH=1 pytest --doctest-modules --disable-warnings --ignore=experiments --splits 5 --group ${{ matrix.group }} --splitting-algorithm least_duration | |
# Publish to pypi on version change | |
# This is based on https://github.com/coveooss/pypi-publish-with-poetry | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Download built package | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- name: Install poetry | |
uses: Gr1N/setup-poetry@v8 | |
- name: Install coveo-pypi-cli | |
run: pip install coveo-pypi-cli | |
- name: Determine the version for this release from the build | |
id: current | |
run: | | |
BUILD_VER="$(ls dist/summit-*.tar.gz)" | |
echo "Path: $BUILD_VER" | |
if [[ $BUILD_VER =~ (summit-)([^,][0-9.]{4}) ]]; then | |
echo "::set-output name=version::${BASH_REMATCH[2]}" | |
echo "Version of build: ${BASH_REMATCH[2]}" | |
else | |
echo "No version found found" | |
fi | |
- name: Get latest published version | |
id: published | |
run: | | |
PUB_VER="$(pypi current-version summit)" | |
echo "::set-output name=version::$PUB_VER" | |
echo "Latest published version: $PUB_VER" | |
- name: Publish to pypi if new version | |
if: (steps.current.outputs.version != steps.published.outputs.version) | |
shell: bash | |
run: | | |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
if [[ '${{ github.ref_name }}' == 'main' ]]; then | |
poetry publish | |
else | |
echo "Dry run of publishing the package" | |
poetry publish --dry-run | |
fi | |
- name: Tag repository | |
shell: bash | |
id: get-next-tag | |
if: (steps.current.outputs.version != steps.published.outputs.version) | |
run: | | |
TAG_NAME=${{ steps.current.outputs.version }} | |
echo "::set-output name=tag-name::$TAG_NAME" | |
echo "This release will be tagged as $TAG_NAME" | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git tag --annotate --message="Automated tagging system" $TAG_NAME ${{ github.sha }} | |
- name: Push the tag | |
if: (steps.current.outputs.version != steps.published.outputs.version) | |
env: | |
TAG_NAME: ${{ steps.current.outputs.version }} | |
run: | | |
if [[ ${{ github.ref_name }} == 'main' ]]; then | |
git push origin $TAG_NAME | |
else | |
echo "If this was the main branch, I would push a new tag named $TAG_NAME" | |
fi |