add test workflow #25
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: run tests | |
on: [push] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Authenticate to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
token_format: access_token | |
workload_identity_provider: projects/949875736540/locations/global/workloadIdentityPools/external-pool/providers/github-provider | |
service_account: [email protected] | |
- name: Login to GAR | |
uses: docker/login-action@v3 | |
with: | |
registry: europe-west3-docker.pkg.dev | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- uses: hoverkraft-tech/[email protected] | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
sudo apt-get install jq curl | |
- name: Run example | |
run: | | |
ACCOUNT_RESPONSE=$(curl -v --location "http://localhost:9000/v1/accounts" \ | |
--header "Content-Type: application/json" \ | |
--data-raw '{ | |
"companyName": "demo", | |
"email": "[email protected]", | |
"password": "Password1234!" | |
}'); | |
export TALON_USER_ID=$(echo $ACCOUNT_RESPONSE | jq ".userId"); | |
export TALON_USER_TOKEN=$(echo $ACCOUNT_RESPONSE | jq ".token"); | |
USER_RESPONSE=$(curl -v --location "http://localhost:9000/v1/users/$TALON_USER_ID" \ | |
--header "Authorization: $TALON_USER_TOKEN"); | |
export TALON_ACCOUNT_ID=$(echo $USER_RESPONSE | jq ".accountId"); | |
echo "User with ID $TALON_USER_ID and Token $TALON_USER_TOKEN was created for application $TALON_ACCOUNT_ID"; | |
export TALON_API_KEY=$(curl -v --location "http://localhost:9000/v1/applications/$TALON_ACCOUNT_ID/apikeys" \ | |
--header "Content-Type: application/json" \ | |
--header "Authorization: $TALON_USER_TOKEN" \ | |
--data-raw '{ | |
"title": "Application HIT KEY", | |
"expires": "2099-01-01T0:00:00Z, | |
}' | jq ".apiKey"); | |
echo "Api-Key $TALON_API_KEY created" | |
python example.py; |