Add files via upload #89
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
# Train model, build containerized model, and deploy model | |
name: CI/CD | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
# Run workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
train: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out repository under $GITHUB_WORKSPACE, so the job can access it | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10.* | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.10.* | |
- name: Install dependencies | |
run: | | |
make install | |
# - name: Set path | |
# run: | | |
# chmod +x set_path.sh | |
# bash ./set_path.sh | |
- name: Sort imports with isort | |
run: | | |
make isort | |
- name: Format with black | |
run: | | |
make format | |
- name: Test with pytest | |
run: | | |
make test | |
- name: Lint with pylint | |
run: | | |
make lint | |
- name: Prepare data | |
run: make prep_data | |
# - name: Split data | |
# run: make split_data | |
# Data splits were already saved in Hugging Face repo | |
# - name: Train | |
# env: | |
# COMET_API_KEY: ${{secrets.COMET_API_KEY}} | |
# run: | | |
# make train | |
- name: Evaluate models | |
env: | |
COMET_API_KEY: ${{secrets.COMET_API_KEY}} | |
run: | | |
make evaluate | |
build: | |
runs-on: ubuntu-latest | |
needs: train | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
# Login using same GitHub Actions credentials | |
- name: Log in to GitHub container registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
# Ensures that repo name is lowercase, which is a requirement for publishing to ghcr.io | |
- name: Lowercase the repo name and username | |
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
- name: Build and push container image to registry | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ghcr.io/${{ env.REPO }}:${{ github.sha }} | |
file: ./src/inference/Dockerfile |