This repository has been archived by the owner on Jan 21, 2025. It is now read-only.
build(deps-dev): bump black from 23.7.0 to 24.3.0 in /py-sdk/sdk #39
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: Test | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- 'release/**' | |
- 'hotfix/**' | |
pull_request: | |
paths: | |
- 'go-sdk/**/*' | |
- 'py-sdk/**/*' | |
- '.github/workflows/test.yaml' | |
branches: | |
# Destination branches | |
- 'develop' | |
jobs: | |
check-folder-changes: | |
runs-on: ubuntu-latest | |
name: Check folder changes | |
outputs: | |
go-sdk: ${{ steps.filter.outputs.go-sdk }} | |
py-sdk: ${{ steps.filter.outputs.py-sdk }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
go-sdk: | |
- 'go-sdk/**/*' | |
- '.github/workflows/test.yaml' | |
py-sdk: | |
- 'py-sdk/**/*' | |
- '.github/workflows/test.yaml' | |
unit-tests: | |
runs-on: ubuntu-latest | |
name: Linting and Unit tests | |
needs: check-folder-changes | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- component: go-sdk | |
changes: ${{ needs.check-folder-changes.outputs.go-sdk }} | |
- component: py-sdk | |
changes: ${{ needs.check-folder-changes.outputs.py-sdk }} | |
steps: | |
- name: Checkout code | |
if: matrix.changes == 'true' | |
uses: actions/checkout@v4 | |
- name: Install Go | |
if: matrix.changes == 'true' && matrix.component == 'go-sdk' | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.x | |
- name: Run linters Go | |
if: matrix.changes == 'true' && matrix.component == 'go-sdk' | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: latest | |
working-directory: ./${{ matrix.component }} | |
args: --timeout=5m | |
- name: Install Python | |
if: matrix.changes == 'true' && matrix.component == 'py-sdk' | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11.5 | |
- name: Install poetry and dependencies | |
if: matrix.changes == 'true' && matrix.component == 'py-sdk' | |
run: | | |
python -m pip install poetry=="1.7.1" | |
python -m poetry install --with dev | |
working-directory: ./${{ matrix.component }} | |
# - name: Run mypy | |
# if: matrix.changes == 'true' && matrix.component == 'py-sdk' | |
# run: make mypy | |
# working-directory: ./ | |
- name: Run unit tests Go | |
if: matrix.changes == 'true' && matrix.component == 'go-sdk' | |
run: go test ./... -cover -v -coverpkg=./... -coverprofile=coverage-unit.out --tags=unit | |
working-directory: ./${{ matrix.component }} | |
- name: Run unit tests Python | |
if: matrix.changes == 'true' && matrix.component == 'py-sdk' | |
run: python -m poetry run pytest sdk runner --cov --cov-report=term-missing --cov-report=xml:coverage-unit.out --cov-config=pyproject.toml --no-cov-on-fail | |
working-directory: ./${{ matrix.component }} | |
- name: Run integration tests Go | |
if: matrix.changes == 'true' && matrix.component == 'go-sdk' | |
run: go test ./... -cover -v -coverpkg=./... -coverprofile=coverage-integration.out --tags=integration | |
working-directory: ./${{ matrix.component }} | |
- name: Archive code coverage results | |
if: matrix.changes == 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-${{ matrix.component }} | |
path: | | |
${{ matrix.component }}/coverage-unit.out | |
${{ matrix.component }}/coverage-integration.out | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
needs: | |
- check-folder-changes | |
- unit-tests | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- component: go-sdk | |
changes: ${{ needs.check-folder-changes.outputs.go-sdk }} | |
sonar_token_secret: SONAR_TOKEN_GO_SDK | |
- component: py-sdk | |
changes: ${{ needs.check-folder-changes.outputs.py-sdk }} | |
sonar_token_secret: SONAR_TOKEN_PYTHON_SDK | |
steps: | |
- uses: actions/checkout@v4 | |
if: matrix.changes == 'true' | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Download code coverage results | |
if: matrix.changes == 'true' | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report-${{ matrix.component }} | |
path: | | |
${{ matrix.component }} | |
- name: SonarCloud Scan | |
if: matrix.changes == 'true' | |
uses: SonarSource/sonarcloud-github-action@master | |
with: | |
projectBaseDir: ${{ matrix.component }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets[matrix.sonar_token_secret] }} | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: | |
- unit-tests | |
- sonarcloud | |
if: github.ref_name == 'main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "19" | |
- name: Run semantic release | |
run: | | |
npm install | |
npx multi-semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} |