diff --git a/.github/workflows/test-code.yaml b/.github/workflows/test-code.yaml index 6a502e1..953f34e 100644 --- a/.github/workflows/test-code.yaml +++ b/.github/workflows/test-code.yaml @@ -1,3 +1,6 @@ +# .github/workflows/test-code.yaml + +# Name of the workflow name: Test code # Trigger when? @@ -7,13 +10,14 @@ on: - 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 - - 'src' - - 'scripts' - - 'services/airflow/dags' - - 'tests' - - 'configs' - - '.github' - # Run this workflow on a scheduled manner given the cron expression (This is a second event to trigger the workflow) + - 'src/**' + - 'scripts/**' + - 'services/airflow/dags/**' + - 'tests/**' + - 'configs/**' + - '.github/**' + schedule: + - cron: '*/5 * * * *' # Allows to only read the contents of the repository # `contents: read` permits an action to list the commits @@ -21,22 +25,17 @@ on: permissions: contents: read -# Decalre environment variables to be used in this workflow file +# Declare environment variables to be used in this workflow file env: message: "Testing code!" # Tasks jobs: - # Task name test-code: - # OS to run the task runs-on: ubuntu-latest # The ubuntu-latest label currently uses the Ubuntu 22.04 runner image - # for more info about the given resources, check this link below - # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories - defaults: # Set working directory of the job run: shell: bash # Set the default shell @@ -44,46 +43,21 @@ jobs: # The steps of the task/job steps: - - # Task name - name: Checking out our code - # Action type - # This action check out the repository in the runner. uses: actions/checkout@v4 - # for more info, check the link below - # https://github.com/actions/checkout - # Install a version of Python - name: setup python uses: actions/setup-python@v5 - # for more info, check the link below - # https://github.com/actions/setup-python - - # Install this specific version 3.11.0 of Python with: python-version: '3.11.0' cache: 'pip' # caching pip dependencies - # Install Python packages - name: install python packages - - # `run` allows to run shell commands - # We can use operator `|` for a multi-line command run: | - python3.11 -m pip install --upgrade pip - pip3.11 install -r requirements.txt - - # You do not need to create a virtual environment here, just use the global installation of Python - # Check if requirements.txt file is there - # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python3.11 -m pip install --upgrade pip + pip3.11 install -r requirements.txt - # Task name - name: Run your app - - # A one-line shell command - # This will run the application in the background - # It is useful for apps which block the shell - # to allow next commands to run run: python3.11 src/app.py & - name: Export variables @@ -97,32 +71,18 @@ jobs: - name: Run ZenML server run: zenml down && zenml up - # Run pytest on tests folder - name: Test with pytest run: pytest tests - - # Another job print_info: + runs-on: ubuntu-latest + needs: test-code + steps: + - name: print my password + run: | + echo My password is ${{ secrets.PASSWORD }} + echo My name is '${{ vars.NAME }}' - runs-on: ubuntu-latest - - - # Run this job after running the job `test-code` - # This allows to set dependency between the jobs - needs: test-code - - - steps: - - # Print passwords and some variables defined on Github website - - name: print my password - run: | - echo My password is ${{ secrets.PASSWORD }} - echo My name is '${{ vars.NAME }}' - - # Print some message defined as environment variable - - name: print message - run: echo $message - + - name: print message + run: echo $message