feat(api): Refactor API server to introduce support for Docker image registries and s3 bucket support #724
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: engines/pyfunc-ensembler-service | |
on: | |
# Automatically run CI on Release and Pre-Release tags and main branch | |
# (only if there are changes to relevant paths) | |
push: | |
tags: | |
- "pyfunc-ensembler-service/v[0-9]+.[0-9]+.[0-9]+*" | |
branches: | |
- main | |
paths: | |
- ".github/workflows/pyfunc-ensembler-service.yaml" | |
- "engines/pyfunc-ensembler-service/**" | |
- "sdk/**" | |
# Automatically run CI on branches, that have active PR opened | |
pull_request: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/pyfunc-ensembler-service.yaml" | |
- "engines/pyfunc-ensembler-service/**" | |
- "sdk/**" | |
# To make it possible to trigger e2e CI workflow for any arbitrary git ref | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache-dependency-path: | | |
engines/pyfunc-ensembler-service/env-${{ matrix.python-version }}.yaml | |
engines/pyfunc-ensembler-service/requirements.txt | |
engines/pyfunc-ensembler-service/requirements.dev.txt | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
- name: Run Tests | |
working-directory: engines/pyfunc-ensembler-service | |
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 | |
- id: release-rules | |
uses: ./.github/actions/release-rules | |
with: | |
prefix: pyfunc-ensembler-service/ | |
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 ) | |
environment: ${{ needs.release-rules.outputs.release-type == 'dev' && 'manual' || '' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
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-service | |
env: | |
DOCKER_REGISTRY: ghcr.io/${{ github.repository }} | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
run: | | |
set -o pipefail | |
make build-image | tee output.log | |
echo "::set-output name=pyfunc-ensembler-service-image::$(sed -n 's%Building docker image: \(.*\)%\1%p' output.log)" | |
- name: Publish Pyfunc Ensembler Service Docker Image | |
run: docker push ${{ steps.build.outputs.pyfunc-ensembler-service-image }} |