ci: added dependabot config #342
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Pull request build | |
on: | |
pull_request: | |
# branches: | |
# - dev | |
jobs: | |
build-app: | |
runs-on: ubuntu-latest | |
name: Build project | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Setup Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Cache pip repository | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements_test.txt') }} | |
- name: Prepare python environment | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt -r requirements_test.txt | |
- name: Lint project with python linters | |
run: | | |
black --check app/ | |
flake8 --count --statistics app/ | |
isort --check-only app/ | |
mypy --ignore-missing-imports app/ | |
yamllint --format colored --strict . | |
- name: Test project | |
run: pytest -v --cov --cov-report=xml:coverage.xml --junit-xml junit.xml | |
- name: Report test summary | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
test_changes_limit: 0 | |
files: ./junit.xml | |
report_individual_runs: true | |
- name: Push to CodeCov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
build-docker: | |
runs-on: ubuntu-latest | |
name: Build docker | |
permissions: | |
pull-requests: read | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get current date | |
id: getDate | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} | |
restore-keys: ${{ runner.os }}-buildx- | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2.2.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2.9.1 | |
- name: Build docker image (no push) | |
uses: docker/build-push-action@v4.1.1 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 | |
build-args: | | |
VCS_REF=${{ github.sha }} | |
BUILD_DATE=${{ steps.getDate.outputs.date }} | |
VERSION=testing | |
tags: tomerfi/switcher_webapi:testing | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |