-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
144 additions
and
54 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: 🧪 Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image: | ||
required: true | ||
type: string | ||
coverage-file: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
urbantree: | ||
name: 🧪 Test UrbanTree | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.inputs.image == 'urbantree' }} | ||
steps: | ||
# https://github.com/actions/checkout/tree/11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
# https://github.com/actions/cache/tree/6849a6489940f00c2f30c0fb92c6274307ccb58a | ||
- name: 📦 Cache Composer dependencies | ||
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a | ||
with: | ||
path: /tmp/composer-cache | ||
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | ||
|
||
# https://github.com/shivammathur/setup-php/tree/c541c155eee45413f5b09a52248675b1a2575231 | ||
- name: 🐘 Setup PHP with extensions | ||
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 | ||
with: | ||
php-version: 8.4 | ||
coverage: xdebug | ||
extensions: none, ctype, curl, dom, json, libxml, mbstring, pdo, phar, tokenizer, xml, xmlwriter | ||
ini-values: zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On | ||
tools: none | ||
|
||
# https://github.com/php-actions/composer/tree/8a65f0d3c6a1d17ca4800491a40b5756a4c164f3 | ||
- name: 📦 Install Composer dependencies | ||
uses: php-actions/composer@8a65f0d3c6a1d17ca4800491a40b5756a4c164f3 | ||
|
||
- name: 🧪 Run PHPUnit tests with coverage | ||
shell: bash | ||
run: ./vendor/bin/phpunit --log-junit junit.xml --coverage-clover=coverage.xml | ||
|
||
# https://github.com/codecov/test-results-action/tree/9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 | ||
- name: 📊 Upload test results to Codecov | ||
if: ${{ !cancelled() }} | ||
uses: codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 | ||
with: | ||
files: ${{ github.event.inputs.coverage-file }} | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# https://github.com/codecov/codecov-action/tree/015f24e6818733317a2da2edd6290ab26238649a | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a | ||
with: | ||
verbose: true | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
api: | ||
name: 🧪 Test API | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.inputs.image == 'api' }} | ||
steps: | ||
# https://github.com/actions/checkout/tree/11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
# https://github.com/actions/cache/tree/6849a6489940f00c2f30c0fb92c6274307ccb58a | ||
- name: 📦 Cache Python dependencies | ||
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a | ||
with: | ||
path: /root/.cache/pip | ||
key: ${{ runner.os }}-${{ hashFiles('**/requirements-dev.txt') }} | ||
|
||
# https://github.com/actions/setup-python/tree/0b93645e9fea7318ecaed2b359559ac225c90a2b | ||
- name: 🐍 Setup Python | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b | ||
with: | ||
python-version: "3.13.0" | ||
|
||
- name: 📂 Change directory to API | ||
shell: bash | ||
run: cd api | ||
|
||
- name: 📦 Install Python dependencies | ||
shell: bash | ||
run: pip install -r requirements-dev.txt | ||
|
||
- name: 🧪 Run Python tests with coverage | ||
shell: bash | ||
run: pytest tests --cov=./src --cov-report=xml --junitxml=junit.xml | ||
|
||
# https://github.com/codecov/test-results-action/tree/9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 | ||
- name: 📊 Upload test results to Codecov | ||
if: ${{ !cancelled() }} | ||
uses: codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 | ||
with: | ||
files: ${{ github.event.inputs.coverage-file }} | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# https://github.com/codecov/codecov-action/tree/015f24e6818733317a2da2edd6290ab26238649a | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a | ||
with: | ||
verbose: true | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |