perf(dogfood): standardize tests (#129) #25
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: SDK | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
go-sdk: | |
name: Go Check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ '1.19', '1.20' ] | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./sdk/go | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: TruffleHog OSS | |
uses: trufflesecurity/trufflehog@main | |
with: | |
path: ./ | |
base: ${{ github.event.repository.default_branch }} | |
head: HEAD | |
extra_args: --debug --only-verified | |
- name: Test | |
run: go test -v -coverprofile=coverage.out -covermode=atomic -race ./... | |
env: | |
PESTO_TOKEN: ${{ secrets.PESTO_TOKEN }} | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: sdk-go | |
js-sdk: | |
name: JavaScript Check | |
runs-on: ubuntu-latest | |
container: node:lts | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./sdk/javascript | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: TruffleHog OSS | |
uses: trufflesecurity/trufflehog@main | |
with: | |
path: ./ | |
base: ${{ github.event.repository.default_branch }} | |
head: HEAD | |
extra_args: --debug --only-verified | |
- name: Update OS | |
run: > | |
apt-get update -y && apt-get upgrade -y && | |
apt-get install -y curl tar gzip openssl build-essential && | |
curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && | |
apt install -y ./google-chrome-stable_current_amd64.deb | |
- name: Install dependency | |
run: npm ci | |
- name: Lint | |
run: npx eslint --fix --ext .ts --ignore-path .gitignore . | |
- name: Test | |
run: npx vitest run --coverage --threads=false | |
env: | |
PESTO_TOKEN: ${{ secrets.PESTO_TOKEN }} | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: sdk-javascript | |
js-publish: | |
name: JavaScript Publish | |
runs-on: ubuntu-latest | |
needs: | |
- js-sdk | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: python3 bump-nightly.py | |
working-directory: ./sdk | |
- run: npm install | |
working-directory: ./sdk/javascript | |
- run: npm run build | |
working-directory: ./sdk/javascript | |
- run: npm publish --access public --tag nightly | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
working-directory: ./sdk/javascript | |
dotnet-sdk: | |
name: .NET Check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dotnet: [ '3.x', '6.x', '7.x' ] | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./sdk/dotnet | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet }} | |
- name: TruffleHog OSS | |
uses: trufflesecurity/trufflehog@main | |
with: | |
path: ./ | |
base: ${{ github.event.repository.default_branch }} | |
head: HEAD | |
extra_args: --debug --only-verified | |
- name: Test | |
run: dotnet test Pesto.sln --collect "XPlat Code Coverage" | |
env: | |
PESTO_TOKEN: ${{ secrets.PESTO_TOKEN }} | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: sdk-dotnet | |
dotnet-publish: | |
name: .NET Publish | |
runs-on: ubuntu-latest | |
needs: | |
- dotnet-sdk | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "6.x" | |
- run: python3 bump-nightly.py | |
working-directory: ./sdk | |
- name: Pack nugets | |
run: dotnet pack Pesto -c Release --output . | |
working-directory: ./sdk/dotnet | |
- name: Push to NuGet | |
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
working-directory: ./sdk/dotnet | |
python-sdk: | |
name: Python Check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10', '3.11'] | |
timeout-minutes: 30 | |
defaults: | |
run: | |
working-directory: ./sdk/python | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: TruffleHog OSS | |
uses: trufflesecurity/trufflehog@main | |
with: | |
path: ./ | |
base: ${{ github.event.repository.default_branch }} | |
head: HEAD | |
extra_args: --debug --only-verified | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r requirements-test.txt | |
- name: Formatting | |
run: black --check pesto tests | |
- name: Lint | |
run: mypy pesto tests | |
- name: Run Pytest | |
run: pytest . --cov-report term-missing --cov-report xml --cov pesto | |
env: | |
PESTO_TOKEN: ${{ secrets.PESTO_TOKEN }} | |
- name: Code Coverage Report | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: sdk-python |