engines/pyfunc-ensembler-service #14
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.7", "3.8", "3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
- name: Cache Conda environment | |
uses: actions/cache@v2 | |
with: | |
path: engines/pyfunc-ensembler-service/env | |
key: | | |
conda-${{ hashFiles('engines/pyfunc-ensembler-service/env-${{ matrix.python-version }}.yaml') }}-${{ hashFiles('engines/pyfunc-ensembler-service/requirements.txt') }}-${{ hashFiles('engines/pyfunc-ensembler-service/requirements.dev.txt') }} | |
restore-keys: conda- | |
- 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@v3 | |
- 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.7", "3.8", "3.9", "3.10"] | |
needs: | |
- release-rules | |
- test | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
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 }} |