chore(docs): Minor update to initizalize successful #32
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: cicd | |
env: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
on: | |
push: | |
paths: | |
- "python/**" | |
- "cli/**" | |
- ".github/workflows/cicd.yml" | |
permissions: | |
id-token: write | |
contents: write | |
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 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 "COVERAGE_PCT=" $4}' >> $GITHUB_ENV | |
- name: Publish SDK test coverage | |
if: github.ref == 'refs/heads/main' | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_ACCESS_TOKEN }} | |
gistID: a9b9bfdfa0620696fba9e76223790f53 | |
filename: sdk-coverage.json | |
label: SDK coverage | |
message: ${{ env.COVERAGE_PCT }} | |
minColorRange: 50 | |
maxColorRange: 80 | |
valColorRange: ${{ env.COVERAGE_PCT }} | |
build: | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
name: Build package | |
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 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: package | |
path: ./dist/* | |
test-cli-windows: | |
name: Test CLI on windows | |
needs: | |
- build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
- uses: actions/download-artifact@v4 | |
id: download | |
with: | |
name: package | |
path: ./dist | |
- run: cmd /r dir /b /a-d dist > files.txt | |
- run: | | |
$files = Get-Content files.txt | |
foreach ($file in $files) { | |
pip install dist/$file | |
} | |
- 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: Lint (golangci-lint) | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: v1.56.2 | |
working-directory: cli | |
args: --config=../.golangci.yml --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 | |
if: | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache: false | |
- name: Tests | |
working-directory: cli | |
run: go test -coverprofile=c.out ./... | |
- name: Extract Test Coverage Percentage | |
working-directory: cli | |
run: go tool cover -func c.out | fgrep total | awk '{print "COVERAGE_PCT=" $3}' >> $GITHUB_ENV | |
- name: Publish Test Coverage | |
if: github.ref == 'refs/heads/main' | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_ACCESS_TOKEN }} | |
gistID: a9b9bfdfa0620696fba9e76223790f53 | |
filename: cli-coverage.json | |
label: CLI coverage | |
message: ${{ env.COVERAGE_PCT }} | |
minColorRange: 50 | |
maxColorRange: 80 | |
valColorRange: ${{ env.COVERAGE_PCT }} | |
release: | |
if: github.ref == 'refs/heads/main' | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
name: Release | |
needs: | |
- lint-cli | |
- test-cli | |
- test-sdk | |
- lint-sdk | |
- build | |
- test-cli-windows | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
- uses: actions/download-artifact@v4 | |
id: download | |
with: | |
name: package | |
path: ./dist | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache: false | |
- run: pip install python-semantic-release==9.6.0 twine==5.0.0 | |
- run: semantic-release version --commit --tag --push | |
- run: semantic-release publish | |
- run: twine upload --skip-existing --non-interactive dist/* |