Skip to content

Commit

Permalink
ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
sashhhaka committed Jul 24, 2024
1 parent 9b41192 commit 35105ea
Showing 1 changed file with 17 additions and 29 deletions.
46 changes: 17 additions & 29 deletions .github/workflows/validate-model.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# .github/workflows/test-code.yaml

# Name of the workflow
name: Validate model

# Trigger when?
on:
push: # this will trigger the workflow/pipeline only if there is push on `main` branch
push:
branches:
- main
- dev
paths: # the push should be specifically to the folders `src` or `scripts` to trigger this workflow, otherwise, the workflow will not be triggered
paths:
- 'src/**'
- 'scripts/**'
- 'services/airflow/dags/**'
Expand All @@ -18,54 +16,45 @@ on:
- 'configs/**'
- '.github/**'

# Allows to only read the contents of the repository
# `contents: read` permits an action to list the commits
# `contents: write` allows the action to create a release
permissions:
contents: read

# Declare environment variables to be used in this workflow file
env:
message: "Validating model!"

# Tasks
jobs:
# Task name
validate-model:
# OS to run the task
runs-on: ubuntu-latest # The ubuntu-latest label currently uses the Ubuntu 22.04 runner image
runs-on: ubuntu-latest

defaults: # Set working directory of the job
defaults:
run:
shell: bash # Set the default shell
shell: bash
working-directory: .

# The steps of the task/job
steps:
- name: Checking out our code
uses: actions/checkout@v4

- name: setup python
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11.0'
cache: 'pip' # caching pip dependencies
cache: 'pip'

- name: Create and activate virtual environment
run: |
python3.11 -m venv venv # Create a virtual environment named 'venv'
source venv/bin/activate # Activate the virtual environment
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV # Persist venv path
echo "PATH=$VIRTUAL_ENV/bin:$PATH" >> $GITHUB_ENV # Use venv's executables
echo "PYTHONPATH=$PWD" >> $GITHUB_ENV # Persist PYTHONPATH
echo "VIRTUAL_ENV set to $VIRTUAL_ENV"
- name: Install python packages
python3.11 -m venv venv
source venv/bin/activate
echo "VIRTUAL_ENV=$(pwd)/venv" >> $GITHUB_ENV
echo "PATH=$(pwd)/venv/bin:$PATH" >> $GITHUB_ENV
echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
- name: Install Python packages
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements.txt
- name: create-json
- name: Create JSON
id: create-json
uses: jsdaniell/create-json@1.1.2
with:
Expand Down Expand Up @@ -111,7 +100,7 @@ jobs:
export PROJECTPATH=$PWD
export AIRFLOW_HOME=$PWD/services/airflow
export PYTHONPATH=$PWD
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV # Persist across steps
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
- name: Print current directory and list files
run: |
Expand Down Expand Up @@ -141,7 +130,6 @@ jobs:
- name: Run validation for champion model
run: python3.11 src/validate.py

# Another job
print_info:
runs-on: ubuntu-latest
needs: validate-model
Expand Down

0 comments on commit 35105ea

Please sign in to comment.