From f85b7bd5b2c320eb0f1f89c22ee58f182be3d7a3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 19 Sep 2024 14:30:17 +0200 Subject: [PATCH] tec: Split tests and linters on the CI --- .github/workflows/linters.yml | 63 +++++++++++++++++++++++++ .github/workflows/{ci.yml => tests.yml} | 16 +------ 2 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/linters.yml rename .github/workflows/{ci.yml => tests.yml} (82%) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 00000000..b592f80b --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,63 @@ +name: Linters + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + NO_DOCKER: true + +jobs: + build: + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + operating-system: [ubuntu-22.04] + php-versions: ['8.2', '8.3'] + + name: PHP ${{ matrix.php-versions }} CI on ${{ matrix.operating-system }} + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: xdebug + extensions: intl, gettext, pcntl, gd, pdo, pdo_pgsql + ini-values: browscap=${{ github.workspace }}/docker/lite_php_browscap.ini + + - name: Setup locales + run: | + sudo apt-get install locales + sudo locale-gen fr_FR.UTF-8 en_GB.UTF-8 + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Cache node dependencies + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- + + - name: Install dependencies + run: make install + + - name: Run the linters + run: make lint diff --git a/.github/workflows/ci.yml b/.github/workflows/tests.yml similarity index 82% rename from .github/workflows/ci.yml rename to .github/workflows/tests.yml index 7506ae56..50ba5b5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Continuous Integration +name: Tests on: push: @@ -14,8 +14,6 @@ env: DB_PASSWORD: postgres COVERAGE: --coverage-text MOCK_HOST: "http://127.0.0.1:8001" - APP_SUBSCRIPTIONS_HOST: ${{ secrets.APP_SUBSCRIPTIONS_HOST }} - APP_SUBSCRIPTIONS_PRIVATE_KEY: ${{ secrets.APP_SUBSCRIPTIONS_PRIVATE_KEY }} jobs: build: @@ -67,24 +65,14 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - - name: Cache node dependencies - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: ${{ runner.os }}-node- - - name: Install dependencies - run: make install + run: composer install - name: Setup the application run: make setup env: DB_PORT: ${{ job.services.postgres.ports[5432] }} - - name: Run the linters - run: make lint - - name: Run mock_server (background) run: php -t ${{ github.workspace }} -S 127.0.0.1:8001 ${{ github.workspace }}/tests/mock_server/index.php &