-
Notifications
You must be signed in to change notification settings - Fork 54
DXE-6465 Add GithubActions workflow for unit tests #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
301e103
9c92a0d
f612581
95f6eb4
e1f047b
bacc830
ccdf62a
e446839
6f945f1
2790889
a037aac
b20acc8
9f71ad4
ff69d69
dea7086
6632c98
c2ab204
a1f1369
1599ee3
ee9dce9
ab86e66
fd9ddd0
b89fea7
ad23eed
4f952a9
08058a8
d1c1ebc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: Unit Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, we want to have the builds on push only for main branches (so effectively it'll be probably on merge, right?). Don't we want to have builds on other branches as well on push (as we currently have on Jenkin? Or are we worried about some bot spamming the branches and crowding our builds?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a minimal setup that:
I think we may expand 2. gradually, when there is a need to cover release/feature branches, for example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand it. My point is that, in comparison to the current Jenkins pipeline, we loose ability to run builds automatically on push on any branch (currently build is run only during creation of PR)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are subtleties to discuss here so I recommend to close this thread and adjust this aspect later. |
||
| branches: [ main, master ] | ||
| schedule: | ||
| - cron: "0 3 * * *" # 03:00 UTC daily | ||
|
mimazaka marked this conversation as resolved.
|
||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Python ${{ matrix.python-version }} | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
|
artbookspirit marked this conversation as resolved.
|
||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: python -m pip install -r dev-requirements.txt | ||
|
|
||
| - name: Remove legacy namespace package declaration | ||
| # Temporary workaround: pkg_resources is no longer pre-installed in Python 3.12+, | ||
| # causing an import error at test collection time. This removes the legacy | ||
| # declare_namespace() call so tests can run without requiring pkg_resources. | ||
| run: sed -i "/declare_namespace/d" akamai/__init__.py | ||
|
|
||
|
artbookspirit marked this conversation as resolved.
|
||
| - name: Lint | ||
| run: pylint akamai | ||
|
|
||
| - name: Run unit tests | ||
| run: | | ||
| pytest \ | ||
| --junitxml test/tests.xml \ | ||
| --cov-report xml:test/coverage/cobertura-coverage.xml \ | ||
| --cov=akamai | ||
|
artbookspirit marked this conversation as resolved.
|
||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: test-results-${{ matrix.python-version }} | ||
| path: test/ | ||
|
|
||
| report: | ||
| name: Test Report | ||
| needs: test | ||
| if: always() | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| checks: write | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Download test results | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| pattern: test-results-* | ||
| merge-multiple: false | ||
|
|
||
| - name: Publish test report | ||
| # dorny/test-reporter v3.0.0 — pinned to SHA for supply-chain safety | ||
| uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 | ||
|
wzagrajcz marked this conversation as resolved.
|
||
| with: | ||
| name: Pytest Results | ||
| path: "test-results-*/tests.xml" | ||
| reporter: java-junit | ||
|
wzagrajcz marked this conversation as resolved.
|
||
Uh oh!
There was an error while loading. Please reload this page.