Skip to content

Commit

Permalink
chore: ci/cd unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0x6f677548 committed Oct 24, 2023
1 parent bda7dbb commit c9bdea7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Test

on:
push:
branches: [master, main]
# only when python files are changed
paths:
- '**.py'
pull_request:
branches: [master, main]

workflow_dispatch:

# set the run-name
run-name: ${{ github.ref_name }} -> Test (
${{ github.run_attempt }}
)


jobs:
lint:

name: Tests
runs-on: ubuntu-latest

steps:
- name: Get current date and time
id: datetime
run: |
datetime=$(date +'%Y-%m-%dT%H-%M-%SZ')
echo "datetime=$datetime" >> $GITHUB_OUTPUT
- name: Display date/time in output (forensics when triaging issues)
run: echo ${{ steps.datetime.outputs.datetime }}

- name: Checkout Code
uses: actions/[email protected]

- name: Set up Python 3.11
uses: actions/[email protected]
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest
- name: Run tests
run: |
pytest --log-level DEBUG --tenant_id ${{ vars.TEST_TENANT_ID}} --client_id ${{ vars.TEST_CLIENT_ID }} --client_secret ${{ secrets.TEST_CLIENT_SECRET }} tests
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dependencies = [
"pytest",
]
[tool.hatch.envs.default.scripts]
test = "pytest --access_token $(ca-pwt acquire-token --output_token) {args:tests}"
test = "pytest --access_token $(ca-pwt acquire-token --output_token {args:tests})"
test-cov = "coverage run -m pytest --access_token $(ca-pwt acquire-token --output_token) {args:tests}"
cov-report = [
"- coverage combine",
Expand Down

0 comments on commit c9bdea7

Please sign in to comment.