Skip to content

Merge pull request #761 from Diego-H-S/genesys_interaction_viewtype #1969

Merge pull request #761 from Diego-H-S/genesys_interaction_viewtype

Merge pull request #761 from Diego-H-S/genesys_interaction_viewtype #1969

Workflow file for this run

name: build
on:
push:
branches:
- "main"
- "dev"
pull_request:
branches:
- "main"
- "dev"
env:
IMAGE_NAME: viadot
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# 3.8+. 3.9 should be supported by late 2021.
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
id: cache-pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r requirements.txt
if: steps.cache.outputs.cache-hit != 'true'
continue-on-error: false
- name: Lint with flake8
if: always()
run: |
pip install flake8
# 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=88 --statistics --ignore=E203
- name: Format imports with isort
if: always()
run: |
pip install isort
isort --profile black .
- name: Format with black
id: blackCheck
if: always()
run: |
pip install black
black --check .
continue-on-error: true
- name: Commit Black changes to the pull request
if: ${{ always() && steps.blackCheck.outcome == 'failure' }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
black .
git checkout $GITHUB_HEAD_REF
git commit -am "🎨 Format Python code with Black"
git push
- name: Test with pytest
if: always()
env:
VIADOT_CONFIG_PATH: .config/credentials.json.template
run: |
pip install pytest
sudo apt install libsqliteodbc
pytest tests/unit
# - name: Generate coverage report
# run: |
# pytest --cov-report xml --cov=viadot tests/
# - name: Upload coverage report to Codecov
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
publish_docker:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
steps:
- name: 'Checkout source code'
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Build image
run: export DOCKER_BUILDKIT=1 && docker build . --file docker/Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Publish with the `dev` label
echo IMAGE_ID=$IMAGE_ID
docker tag $IMAGE_NAME $IMAGE_ID:dev
docker push $IMAGE_ID:dev