Skip to content

engines/pyfunc-ensembler-job #813

engines/pyfunc-ensembler-job

engines/pyfunc-ensembler-job #813

name: engines/pyfunc-ensembler-job
on:
# The package build by this job requires latest version of sdk,
# so we can only run this workflow after sdk workflow is successfully run
workflow_run:
workflows: ["sdk"]
types:
- completed
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache-dependency-path: |
engines/pyfunc-ensembler-job/requirements.txt
engines/pyfunc-ensembler-job/requirements.dev.txt
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
- name: Run Tests
working-directory: engines/pyfunc-ensembler-job
run: |
make setup
make test
release-rules:
runs-on: ubuntu-latest
outputs:
release-type: ${{ steps.release-rules.outputs.release-type }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: release-rules
uses: ./.github/actions/release-rules
with:
prefix: python/
publish:
# Automatically publish release and pre-release artifacts.
#
# As for dev releases, make it possible to publish artifacts
# manually by approving 'deployment' in the 'manual' environment.
#
# Dev build can be released either from the 'main' branch or
# by running this workflow manually with `workflow_dispatch` event.
if: >-
(contains('release,pre-release', needs.release-rules.outputs.release-type)
|| ( github.event_name != 'pull_request' )
|| ( github.event.pull_request.head.repo.full_name == github.repository )) &&
${{ github.event.workflow_run.conclusion == 'success' }}
environment: ${{ needs.release-rules.outputs.release-type == 'dev' && 'manual' || '' }}
runs-on: ubuntu-latest
needs:
- release-rules
- test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image
id: build
working-directory: engines/pyfunc-ensembler-job
env:
DOCKER_REGISTRY: ghcr.io/${{ github.repository }}
run: |
set -o pipefail
make build-image | tee output.log
echo "::set-output name=pyfunc-ensembler-job::$(sed -n 's%Building docker image: \(.*\)%\1%p' output.log)"
- name: Publish Pyfunc Ensembler Job Docker Image
run: docker push ${{ steps.build.outputs.pyfunc-ensembler-job }}
- name: Publish pyfunc-ensembler-job package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
working-directory: engines/pyfunc-ensembler-job
run: |
set -o pipefail
make build-and-publish | tee output.log
echo "pyfunc-ensembler-job=$(sed -n 's%Building docker image: \(.*\)%\1%p' output.log)" >> $GITHUB_OUTPUT