diff --git a/.github/workflows/test-eslint.yml b/.github/workflows/test-eslint.yml new file mode 100644 index 00000000..4401833b --- /dev/null +++ b/.github/workflows/test-eslint.yml @@ -0,0 +1,52 @@ +name: ESLint Tests + +on: + push: + branches: + - master + paths: + - 'packages/eslint-config-humanmade/**' + - 'package.json' + - 'package-lock.json' + - '.github/workflows/test-eslint.yml' + pull_request: + paths: + - 'packages/eslint-config-humanmade/**' + - 'package.json' + - 'package-lock.json' + - '.github/workflows/test-eslint.yml' + +permissions: + contents: read + +jobs: + test: + name: ESLint / Node ${{ matrix.node-version }} + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: + - 20 + - 22 + - 24 + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install root dependencies + run: npm ci + + - name: Install ESLint package dependencies + working-directory: packages/eslint-config-humanmade + run: npm ci + + - name: Run ESLint tests + run: npm run test:eslint diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml new file mode 100644 index 00000000..02c6febf --- /dev/null +++ b/.github/workflows/test-php.yml @@ -0,0 +1,67 @@ +name: PHP Tests + +on: + push: + branches: + - master + paths: + - 'HM/**' + - 'HM-Minimum/**' + - 'tests/**' + - 'composer.json' + - 'phpunit.xml.dist' + - 'ruleset.xml' + - '.github/workflows/test-php.yml' + pull_request: + paths: + - 'HM/**' + - 'HM-Minimum/**' + - 'tests/**' + - 'composer.json' + - 'phpunit.xml.dist' + - 'ruleset.xml' + - '.github/workflows/test-php.yml' + +permissions: + contents: read + +jobs: + test: + name: PHP ${{ matrix.php-version }} + runs-on: ubuntu-latest + + strategy: + matrix: + php-version: + - '8.2' + - '8.3' + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 + with: + php-version: ${{ matrix.php-version }} + coverage: none + + - name: Cache Composer dependencies + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/composer/files + key: composer-${{ matrix.php-version }}-${{ hashFiles('composer.json') }} + restore-keys: | + composer-${{ matrix.php-version }}- + composer- + + - name: Install Composer dependencies + # Ignore platform requirements as PHPUnit may require a higher PHP version than the minimum supported. + run: composer install --ignore-platform-reqs + + - name: Run PHPUnit (AllSniffs) + # Pass settings via CLI to avoid PHPUnit config file compatibility issues across versions. + run: vendor/bin/phpunit --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests tests/AllSniffs.php + + - name: Run PHPUnit (FixtureTests) + run: vendor/bin/phpunit --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests tests/FixtureTests.php diff --git a/.github/workflows/test-stylelint.yml b/.github/workflows/test-stylelint.yml new file mode 100644 index 00000000..f279cd09 --- /dev/null +++ b/.github/workflows/test-stylelint.yml @@ -0,0 +1,52 @@ +name: Stylelint Tests + +on: + push: + branches: + - master + paths: + - 'packages/stylelint-config/**' + - 'package.json' + - 'package-lock.json' + - '.github/workflows/test-stylelint.yml' + pull_request: + paths: + - 'packages/stylelint-config/**' + - 'package.json' + - 'package-lock.json' + - '.github/workflows/test-stylelint.yml' + +permissions: + contents: read + +jobs: + test: + name: Stylelint / Node ${{ matrix.node-version }} + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: + - 20 + - 22 + - 24 + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install root dependencies + run: npm ci + + - name: Install Stylelint package dependencies + working-directory: packages/stylelint-config + run: npm ci + + - name: Run Stylelint tests + run: npm run test:stylelint diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 206de4d9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,96 +0,0 @@ -# Setup caching -cache: - directories: - - $HOME/.cache/composer/files - - $HOME/.npm - - node_modules - -branches: - only: - - master - -# Test in modern and recent versions of PHP & Node. -# Run each code style tool in containers specific to that tool's language. -jobs: - include: - - language: php - php: 8.2 - install: - # For PHP 8.0+, we need to ignore platform reqs as PHPUnit 7 is still used. - - composer install --ignore-platform-reqs - script: - # For PHP 8.1+, we need to ignore the config file so that PHPUnit 7 doesn't try to read it and cause an error. - # Instead, we pass all required settings as part of the phpunit command. - - vendor/bin/phpunit --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests tests/AllSniffs.php - - vendor/bin/phpunit --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests tests/FixtureTests.php - - - language: php - php: 8.3 - install: - # For PHP 8.0+, we need to ignore platform reqs as PHPUnit 7 is still used. - - composer install --ignore-platform-reqs - script: - # For PHP 8.1+, we need to ignore the config file so that PHPUnit 7 doesn't try to read it and cause an error. - # Instead, we pass all required settings as part of the phpunit command. - - vendor/bin/phpunit --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests tests/AllSniffs.php - - vendor/bin/phpunit --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests tests/FixtureTests.php - - - language: node_js - node_js: 20 - install: - - npm ci - - cd packages/eslint-config-humanmade - - npm ci - - cd ../.. - script: - - npm run test:eslint - - - language: node_js - node_js: 20 - install: - - npm ci - - cd packages/stylelint-config - - npm ci - - cd ../.. - script: - - npm run test:stylelint - - - language: node_js - node_js: 22 - install: - - npm ci - - cd packages/eslint-config-humanmade - - npm ci - - cd ../.. - script: - - npm run test:eslint - - - language: node_js - node_js: 22 - install: - - npm ci - - cd packages/stylelint-config - - npm ci - - cd ../.. - script: - - npm run test:stylelint - - - language: node_js - node_js: 24 - install: - - npm ci - - cd packages/eslint-config-humanmade - - npm ci - - cd ../.. - script: - - npm run test:eslint - - - language: node_js - node_js: 24 - install: - - npm ci - - cd packages/stylelint-config - - npm ci - - cd ../.. - script: - - npm run test:stylelint