fix(python-sdk): tighten user collection return type, and update docs… #523
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: Validate | |
on: | |
push: | |
jobs: | |
lint-sdk: | |
name: Lint python SDK | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
- run: pip install .[dev] | |
- run: python -m ruff check ./python | |
- run: python -m ruff format --check ./python | |
- run: python -m mypy --strict ./python | |
test-sdk: | |
name: Unit test python SDK | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
- run: pip install -e .[dev] | |
- run: coverage run -m pytest -vv ./python/tests/ | |
- run: coverage report | grep 'TOTAL' | awk '{print $4}' > ./sdk-coverage.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: sdk-coverage | |
path: ./sdk-coverage.txt | |
build: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
name: Build | |
strategy: | |
matrix: | |
platform: ["darwin_amd64", "darwin_arm64", "linux_amd64", "linux_arm64", "windows_amd64", "windows_arm64"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache: false | |
- run: python3 -m pip install python-semantic-release==9.6.0 build>=1.2.1 | |
- run: semantic-release version --no-commit --no-tag --no-push --no-changelog # update version locally to build new version | |
- run: make package-${{ matrix.platform }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.platform }} | |
path: ./dist/* | |
collect-dists: | |
name: Collect dists | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-darwin_amd64 | |
path: ./dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-darwin_arm64 | |
path: ./dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-linux_amd64 | |
path: ./dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-linux_arm64 | |
path: ./dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-windows_amd64 | |
path: ./dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-windows_arm64 | |
path: ./dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./dist/* | |
test-cli-windows: | |
name: Test CLI on windows | |
runs-on: windows-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-windows_amd64 | |
path: ./dist | |
- run: pip install pypiserver | |
- run: | | |
python -m pypiserver run -p 8000 ./dist & | |
pip install --index-url=http://localhost:8000/simple numerous | |
- run: numerous --help | |
lint-cli: | |
name: Lint CLI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
cache: false | |
- name: Create version.txt | |
run: make version | |
- name: Lint (golangci-lint) | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: v1.59.0 | |
args: --verbose | |
- name: Install gofumpt | |
shell: bash | |
run: | | |
wget https://github.com/mvdan/gofumpt/releases/download/v0.6.0/gofumpt_v0.6.0_linux_amd64 | |
mv gofumpt_v0.6.0_linux_amd64 gofumpt | |
chmod +x gofumpt | |
mv gofumpt /usr/local/bin | |
- name: Check gofumpt formatting | |
shell: bash | |
run: | | |
unformatted_files=$(gofumpt -l .) | |
if [[ "$unformatted_files" != "" ]]; then | |
echo "Some files do not adhere to gofumpt formatting:" | |
echo "$unformatted_files" | |
exit 1 | |
fi | |
test-cli: | |
name: Unit test CLI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache: false | |
- name: Create version.txt | |
run: make version | |
- name: Tests | |
run: go test -coverprofile=c.out ./... | |
- name: Extract Test Coverage Percentage | |
run: go tool cover -func c.out | fgrep total | awk '{print $3}' > ./cli-coverage.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cli-coverage | |
path: cli-coverage.txt |