-
-
Notifications
You must be signed in to change notification settings - Fork 632
Extract backend tests workflow and remove docker layer #4635
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
Open
ahmedxgouda
wants to merge
9
commits into
OWASP:feature/ci-cd-optimization
Choose a base branch
from
ahmedxgouda:ci/backend-tests
base: feature/ci-cd-optimization
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+77
−42
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0e69ab8
Extract backend tests workflow and remove docker layer
ahmedxgouda 8521207
Add permissions
ahmedxgouda dbbdf18
Add FORCE_COLOR env
ahmedxgouda a7d3511
Fix ordering
ahmedxgouda 761f6dc
Optimize dependecies installation
ahmedxgouda a81f78c
Update cache path and comments identation
ahmedxgouda 1caef9a
Remove dead code
ahmedxgouda 9863bfe
Update code
arkid15r 131671a
Update permissions
arkid15r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Run backend tests | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| env: | ||
| FORCE_COLOR: 1 | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| run-unit-tests: | ||
| name: Run unit tests | ||
| permissions: | ||
| actions: write | ||
| contents: read | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Install Poetry | ||
| run: pipx install poetry | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | ||
| with: | ||
| cache-dependency-path: backend/poetry.lock | ||
| cache: poetry | ||
| python-version: '3.13' | ||
|
|
||
| - name: Set up backend dependencies cache | ||
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | ||
| with: | ||
| key: poetry-venv-${{ runner.os }}-${{ hashFiles('backend/poetry.lock') }} | ||
| path: backend/.venv | ||
|
|
||
| - name: Install backend dependencies | ||
|
ahmedxgouda marked this conversation as resolved.
|
||
| run: poetry install --no-interaction | ||
| working-directory: backend | ||
|
|
||
| - name: Run backend tests | ||
| run: set -a && source .env.example && set +a && poetry run pytest tests/unit | ||
| working-directory: backend | ||
|
|
||
| - name: Upload coverage artifact | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| if-no-files-found: error | ||
| name: coverage-xml | ||
| path: backend/coverage.xml | ||
| timeout-minutes: 5 | ||
|
|
||
| upload-coverage-to-codecov: | ||
| name: Upload coverage to Codecov | ||
| needs: run-unit-tests | ||
| permissions: | ||
| actions: read | ||
| id-token: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download coverage artifact | ||
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | ||
| with: | ||
| name: coverage-xml | ||
| path: backend | ||
|
|
||
| - name: Upload coverage report to Codecov | ||
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | ||
| with: | ||
| fail_ci_if_error: false | ||
| files: backend/coverage.xml | ||
| flags: backend | ||
| use_oidc: true | ||
| timeout-minutes: 5 | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.