Skip to content

fix: Refresh auth token on 500 (#338) #271

fix: Refresh auth token on 500 (#338)

fix: Refresh auth token on 500 (#338) #271

Workflow file for this run

# This workflow will install Python dependencies, run pre-commit checks, and run tests with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Unit tests
on:
workflow_call:
inputs:
branch:
required: false
type: string
description: 'Branch to run on'
secrets:
GIST_PAT:
required: true
push:
branches: [ main, 0.x ]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
ref: ${{ inputs.branch }}
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run unit tests
run: |
pytest --cov=src/ tests/unit --cov-report=xml --alluredir=allure-results
- name: Get Allure history
uses: actions/checkout@v2
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Allure Report
uses: firebolt-db/action-allure-report@v1
if: always()
continue-on-error: true
with:
github-key: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage report
uses: actions/upload-artifact@v2
continue-on-error: true
with:
name: pytest-coverage-report
path: coverage.xml
- name: Extract coverage percent
id: coverage
if: github.event_name == 'push'
continue-on-error: true
run: |
fraction=$(sed -n 2p coverage.xml | sed 's/.*line-rate=\"\([0-9.]*\)\".*$/\1/')
percentage=$(echo "scale=1; $fraction * 100" | bc -l)
percentage_whole=$(echo "${percentage%.*}")
colour=$(if [ $percentage_whole -ge 80 ]; then echo "green"; else echo "orange"; fi)
echo "colour=$colour" >> $GITHUB_OUTPUT
echo "covered=$percentage_whole" >> $GITHUB_OUTPUT
- name: Create Coverage Badge
uses: schneegans/dynamic-badges-action@v1.2.0
if: github.event_name == 'push'
continue-on-error: true
with:
auth: ${{ secrets.GIST_PAT }}
gistID: 65d5a42849fd78f4c6e62fad18490d20
filename: firebolt-sdk-coverage.json
label: Coverage
message: ${{steps.coverage.outputs.covered}}%
color: ${{steps.coverage.outputs.colour}}