Merge pull request #533 from sustainable-computing-io/vm-extractor #133
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
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- main | |
env: | |
TAG: latest | |
jobs: | |
check-branch: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.image-tag.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Find Image Tag | |
id: image-tag | |
env: | |
BRANCH: ${{ github.ref_name }} | |
COMMIT: ${{ github.sha }} | |
run: | | |
if [ "${{ github.event_name }}" == 'pull_request' ]; then | |
echo "tag=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT" | |
else | |
if [ "$BRANCH" == "main" ]; then | |
echo "tag=${{ env.TAG }}" >> "$GITHUB_OUTPUT" | |
else | |
echo "tag=$COMMIT" >> "$GITHUB_OUTPUT" | |
fi | |
fi | |
check-change: | |
runs-on: ubuntu-latest | |
outputs: | |
base: ${{ steps.filter.outputs.base }} | |
modeling: ${{ steps.filter.outputs.modeling }} | |
s3: ${{ steps.filter.outputs.s3 }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
base: | |
- 'pyproject.toml' | |
- 'dockerfiles/Dockerfile.base' | |
- '.github/workflows/build-push.yml' | |
modeling: | |
- 'src/**' | |
- 'model_training/**' | |
- 'hack/**' | |
- '.github/workflows/train-model.yml' | |
s3: | |
- 'model_training/s3/**' | |
build-push: | |
needs: [check-change, check-branch] | |
uses: ./.github/workflows/build-push.yml | |
with: | |
base_change: ${{ needs.check-change.outputs.base }} | |
s3_change: ${{ needs.check-change.outputs.s3 }} | |
image_repo: ${{ vars.IMAGE_REPO }} | |
image_tag: ${{ needs.check-branch.outputs.tag }} | |
push: true | |
secrets: | |
docker_username: ${{ secrets.BOT_NAME }} | |
docker_password: ${{ secrets.BOT_TOKEN }} | |
train-model: | |
needs: [check-change, check-branch, build-push] | |
if: ${{ needs.check-change.outputs.modeling == 'true' }} | |
strategy: | |
matrix: | |
instance_type: [i3.metal] | |
uses: ./.github/workflows/train-model.yml | |
with: | |
pipeline_name: std_v0.7.11 | |
instance_type: ${{ matrix.instance_type }} | |
ami_id: ami-0e4d0bb9670ea8db0 | |
github_repo: ${{ github.repository }} | |
model_server_image: ${{ vars.IMAGE_REPO }}/kepler_model_server:${{ needs.check-branch.outputs.tag }} | |
trainers: LogisticRegressionTrainer,ExponentialRegressionTrainer,SGDRegressorTrainer,GradientBoostingRegressorTrainer,XgboostFitTrainer | |
secrets: | |
self_hosted_github_token: ${{ secrets.GH_SELF_HOSTED_RUNNER_TOKEN }} | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws_region: ${{ secrets.AWS_REGION }} |