From 832d88ca95241a3dbcd06e0806a8b0f5e1f201ec Mon Sep 17 00:00:00 2001 From: Jeremiasz Major Date: Sat, 2 Mar 2024 20:29:37 +0100 Subject: [PATCH] reorganise workflows --- .github/workflows/ci.yml | 178 ++++++++++++++++++++++++++++++++ .github/workflows/integrity.yml | 48 --------- .github/workflows/sca.yml | 49 --------- .github/workflows/style.yml | 46 --------- .github/workflows/tests.yml | 57 ---------- 5 files changed, 178 insertions(+), 200 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/integrity.yml delete mode 100644 .github/workflows/sca.yml delete mode 100644 .github/workflows/style.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..711a37938f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,178 @@ +name: Tests + +on: + push: + branches-ignore: [master] + +jobs: + tests: + name: Tests / PHP ${{ matrix.php }}, ${{ matrix.stability }} + + runs-on: ubuntu-latest + strategy: + matrix: + php: ['8.1', '8.2', '8.3'] + stability: [prefer-lowest, prefer-stable] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '21.3' + + - name: Get Composer cache directory path + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ hashFiles('composer.lock') }} + restore-keys: composer- + + - name: Node assertions cache + uses: actions/cache@v4 + with: + path: .cache/node-assertions + key: node-assertions-${{ github.sha }} + restore-keys: node-assertions- + + - name: Install Composer dependencies + run: composer update --${{ matrix.stability }} + + - name: Execute tests + run: vendor/bin/phpunit + + types: + name: Types / PHP ${{ matrix.php }} + + runs-on: ubuntu-latest + strategy: + matrix: + php: ['8.1', '8.3'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Get Composer cache directory path + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ hashFiles('composer.lock') }} + restore-keys: composer- + + - name: Psalm cache + uses: actions/cache@v4 + with: + path: .cache/psalm + key: psalm-${{ github.sha }} + restore-keys: psalm- + + - name: Install Composer dependencies + run: composer install + + - name: Run Psalm + run: vendor/bin/psalm --output-format=github --no-progress + + style: + name: Style + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + coverage: none + + - name: Get Composer cache directory path + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ hashFiles('composer.lock') }} + restore-keys: composer- + + - name: PHP-CS-Fixer cache + uses: actions/cache@v4 + with: + path: .cache/.php-cs-fixer.cache + key: php-cs-fixer-${{ github.sha }} + restore-keys: php-cs-fixer- + + - name: Install Composer dependencies + run: composer install + + - name: Run PHP-CS-Fixer + run: vendor/bin/php-cs-fixer fix --dry-run --diff --no-interaction + + integrity: + name: Integrity + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: none + + - name: Get Composer cache directory path + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ hashFiles('composer.lock') }} + restore-keys: composer- + + - name: Install Composer dependencies + run: composer install + + - name: Install Yarn dependencies + run: yarn install + + - name: Compile rules + run: | + php gen currencies + php gen numbers + php gen units + + - name: Check for uncommitted changes + run: git add . && git diff --cached --exit-code diff --git a/.github/workflows/integrity.yml b/.github/workflows/integrity.yml deleted file mode 100644 index 48adaf761b..0000000000 --- a/.github/workflows/integrity.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Integrity - -on: - pull_request: - push: - branches-ignore: [master] - -jobs: - integrity: - name: Integrity - - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - coverage: none - - - name: Get Composer cache directory path - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ hashFiles('composer.lock') }} - restore-keys: composer- - - - name: Install Composer dependencies - run: composer install - - - name: Install Yarn dependencies - run: yarn install - - - name: Compile rules - run: | - php gen currencies - php gen numbers - php gen units - - - name: Check for uncommitted changes - run: git add . && git diff --cached --exit-code diff --git a/.github/workflows/sca.yml b/.github/workflows/sca.yml deleted file mode 100644 index 1a88585189..0000000000 --- a/.github/workflows/sca.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Static analysis - -on: - pull_request: - push: - branches-ignore: [master] - -jobs: - psalm: - name: Psalm — PHP ${{ matrix.php }} - - runs-on: ubuntu-latest - strategy: - matrix: - php: ['8.1', '8.3'] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - - - name: Get Composer cache directory path - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ hashFiles('composer.lock') }} - restore-keys: composer- - - - name: Psalm cache - uses: actions/cache@v4 - with: - path: .cache/psalm - key: psalm-${{ github.sha }} - restore-keys: psalm- - - - name: Install Composer dependencies - run: composer install - - - name: Run Psalm - run: vendor/bin/psalm --output-format=github --no-progress diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml deleted file mode 100644 index b9e030ee17..0000000000 --- a/.github/workflows/style.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Style - -on: - pull_request: - push: - branches-ignore: [master] - -jobs: - style: - name: Style - - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - coverage: none - - - name: Get Composer cache directory path - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ hashFiles('composer.lock') }} - restore-keys: composer- - - - name: PHP-CS-Fixer cache - uses: actions/cache@v4 - with: - path: .cache/.php-cs-fixer.cache - key: php-cs-fixer-${{ github.sha }} - restore-keys: php-cs-fixer- - - - name: Install Composer dependencies - run: composer install - - - name: Run PHP-CS-Fixer - run: vendor/bin/php-cs-fixer fix --dry-run --diff --no-interaction diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 0465796a28..0000000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Tests - -on: - pull_request: - push: - branches-ignore: [master] - -jobs: - unit-tests: - name: PHP ${{ matrix.php }}, ${{ matrix.stability }} - - runs-on: ubuntu-latest - strategy: - matrix: - php: ['8.1', '8.2', '8.3'] - stability: [prefer-lowest, prefer-stable] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: '21.3' - - - name: Get Composer cache directory path - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ hashFiles('composer.lock') }} - restore-keys: composer- - - - name: Node assertions cache - uses: actions/cache@v4 - with: - path: .cache/node-assertions - key: node-assertions-${{ github.sha }} - restore-keys: node-assertions- - - - name: Install Composer dependencies - run: composer update --${{ matrix.stability }} - - - name: Execute tests - run: vendor/bin/phpunit