mirror of
https://github.com/tembo-pages/tembo-core.git
synced 2025-12-21 21:25:44 +00:00
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
analysis:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Checkout repo & install Python
|
|
- name: Check out repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
# disable shallow clones for better sonarcloud accuracy
|
|
fetch-depth: 0
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
# Install & configure Poetry
|
|
- name: Install Poetry
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
installer-parallel: true
|
|
# Load cached venv
|
|
- name: Load cached venv
|
|
id: cached-poetry-dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
|
# Install dependencies if no cache
|
|
- name: Install dependencies
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
run: poetry install --no-interaction --no-root
|
|
# Install package if needed
|
|
- name: Install package
|
|
run: poetry install --no-interaction
|
|
# Run tests
|
|
- name: Run tests
|
|
run: |
|
|
source .venv/bin/activate
|
|
pytest -v --cov --junitxml=pytest.xml --suppress-tests-failed-exit-code
|
|
coverage xml -i
|
|
sed -i 's/\/home\/runner\/work\/tembo-core\/tembo-core\///g' coverage.xml
|
|
sed -i 's/\/home\/runner\/work\/tembo-core\/tembo-core\///g' pytest.xml
|
|
# Build docs
|
|
- name: Build docs
|
|
run: |
|
|
source .venv/bin/activate
|
|
coverage html
|
|
mkdocs gh-deploy
|
|
# Upload to sonarcloud
|
|
- name: SonarCloud Scan
|
|
uses: sonarsource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|