Skip to content

fix: logging

fix: logging #165

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
DEPLOYMENT_NAME: "ga4-flattener-deployment"
on:
push:
branches: [ master, development-new-log-sink ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ 3.9 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install flake8 pytest
pip install -r cf/requirements.txt
pip install -r cfintraday/requirements.txt
pip install -r cfconfigbuilder/requirements.txt
pip install -r cfconfigbuilderps/requirements.txt
pip install -r cfintradaysqlview/requirements.txt
pip install -r tests/requirements-test.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Reinstall flattener
run: |
# gcloud
gcloud -v
# auth
echo "$GOOGLE_APPLICATION_CREDENTIALS" > "sandbox/sa.json"
gcloud auth activate-service-account --key-file "sandbox/sa.json"
gcloud config set project "$GCP_PROJECT_ID"
# uninstall
# remove GCS config file
# if we cannot delete, continue with the script
# https://stackoverflow.com/questions/22009364/is-there-a-try-catch-command-in-bash
gsutil rm gs://ga4-flattener-deployment-464892960897-adswerve-ga-flat-config/config_datasets.json || echo "ERROR: cannot delete GCS config file"
gcloud deployment-manager deployments list
gcloud deployment-manager deployments delete "$DEPLOYMENT_NAME" -q || echo "ERROR: cannot delete deployment"
# install
gcloud deployment-manager deployments create "$DEPLOYMENT_NAME" --config ga_flattener.yaml
# check for the config file
gsutil stat gs://ga4-flattener-deployment-464892960897-adswerve-ga-flat-config/config_datasets.json || echo "ERROR: GCS config file not found"
- name: Test with pytest
run: |
# test
pytest --verbose
- name: Clean up
run: |
# clean up
shred --iterations=7 "sandbox/sa.json"
rm --recursive --force "sandbox/sa.json"