Build #285
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: Build | |
on: | |
push: | |
branches-ignore: | |
- 'dependabot/**' | |
paths-ignore: | |
- "docs/**" | |
- "*.md" | |
pull_request: | |
paths-ignore: | |
- "docs/**" | |
- "*.md" | |
release: | |
types: [created] | |
schedule: | |
- | |
cron: "0 1 * * 6" # Run at 1am every Saturday | |
workflow_dispatch: ~ | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
name: "Odoo ${{ matrix.odoo }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
odoo: [13, 14, 15, 16, 17] | |
symfony: ["^6.4", "^7.1"] | |
php: ["8.1", "8.2", "8.3"] # " required to keep the .0 | |
exclude: | |
- | |
symfony: ^7.1 | |
php: "8.1" | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: odoo | |
POSTGRES_USER: odoo | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
ODOO_API_HOST: http://localhost:8069 | |
ODOO_API_DATABASE: odoo-master | |
ODOO_API_USERNAME: admin | |
ODOO_API_PASSWORD: admin | |
ODOO_API_INIT_MODULES: l10n_fr,account_accountant | |
steps: | |
- | |
name: Docker launch Odoo instance | |
run: | | |
docker run \ | |
-d \ | |
--rm \ | |
-p 8069:8069 \ | |
--network ${{ job.services.postgres.network }} \ | |
-e "HOST=postgres" \ | |
--name odoo \ | |
-t odoo:${{ matrix.odoo }} \ | |
-- \ | |
--database "$ODOO_API_DATABASE" --init "$ODOO_API_INIT_MODULES" | |
docker ps --all --filter id=odoo --filter status=running --no-trunc --format "{{.ID}} {{.Status}}" | |
docker port odoo | |
- | |
uses: actions/checkout@v3 | |
- | |
name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "${{ matrix.php }}" | |
extensions: intl, xmlrpc | |
tools: symfony | |
coverage: none | |
- | |
name: Restrict Symfony version | |
if: matrix.symfony != '' | |
run: | | |
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" | |
composer global config --no-plugins allow-plugins.symfony/flex true | |
composer config extra.symfony.require "${{ matrix.symfony }}" | |
- | |
name: Get Composer cache directory | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
id: composer-cache | |
- | |
name: Cache Composer | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- | |
- | |
name: Install PHP dependencies | |
run: composer install --no-interaction | |
- | |
name: Composer validate | |
run: composer validate --strict | |
- | |
name: ECS check | |
run: vendor/bin/ecs check src tests | |
- | |
name: Wait until odoo is ready | |
run: | | |
while ! docker logs "odoo" 2>&1 | grep -q "odoo.modules.loading: Modules loaded"; | |
do | |
sleep 1 | |
echo "Checking if Odoo is fully up..." | |
done | |
echo "Odoo is UP !" | |
- | |
name: Build Odoo tests model classes | |
run: | | |
bin/odoo-model-classes-generator -vvv \ | |
"./tests/TestModel/Object" \ | |
"Tests\\FluxSE\\OdooApiClient\\TestModel\\Object" \ | |
--only-model=account.account \ | |
--only-model=account.journal \ | |
--only-model=account.move \ | |
--only-model=account.move.line \ | |
--only-model=account.payment \ | |
--only-model=account.payment.method \ | |
--only-model=account.payment.register \ | |
--only-model=account.tax \ | |
--only-model=product.category \ | |
--only-model=product.product \ | |
--only-model=product.template \ | |
--only-model=res.currency \ | |
--only-model=res.partner \ | |
--only-model=uom.uom | |
# Need classes from Odoo to be generated for the tests folder | |
- | |
name: Run PHPStan | |
run: vendor/bin/phpstan analyse -l max src/ tests/ | |
- | |
name: Run PHPUnit | |
run: vendor/bin/phpunit --colors=always | |
- | |
name: Remove Odoo instance | |
run: docker rm -f "odoo" |