Skip to content

Commit

Permalink
fix: dependabot and ci updates (pressbooks#3709)
Browse files Browse the repository at this point in the history
* fix: dependabot and ci updates

* build: npm build

* fix: dependabot and ci updates

* build: npm build

* fix: missing matrix deps

* build: npm build

* build: npm build

* fix: npm build step

* chore(l10n): update pot file

* chore: append tools in experimental matrix

* chore(l10n): update pot file

* chore: update phpunit config, update lang

* chore(l10n): update pot file

* ci: update update-pot.yml

* ci: update ensure-npm-build.yml

* chore(l10n): update pot file

* ci: update ensure-npm-build.yml

* chore(l10n): update pot file

* ci: update ensure-npm-build.yml

* build: npm build

* ci: update ensure-npm-build.yml

* chore(l10n): update pot file

* Update ensure-npm-build.yml

* build: npm build

* build: npm build

* wip: test checks

---------

Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
arzola and actions-user authored May 30, 2024
1 parent 0356836 commit 7f05263
Show file tree
Hide file tree
Showing 21 changed files with 849 additions and 788 deletions.
47 changes: 30 additions & 17 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
version: 2
updates:
# Maintain dependencies for npm
- package-ecosystem: "npm"
# Look for `package.json` and `package-lock.json` files in the root directory
# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
# Check for updates weekly
schedule:
interval: "weekly"
allow:
# Allow direct updates only (for packages named in package.json)
- dependency-type: "direct"
# Allow up to 10 open pull requests for npm dependencies
open-pull-requests-limit: 10
open-pull-requests-limit: 5
versioning-strategy: "increase-if-necessary"
ignore:
- dependency-name: "*"
update-types: [ "version-update:semver-major" ]
groups:
composer-dependencies:
dependency-type: "production"
composer-dev-dependencies:
dependency-type: "development"

# Maintain dependencies for Composer
- package-ecosystem: "composer"
# Look for `composer.json` and `composer.lock` files in the root directory
# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
# Check for updates weekly
schedule:
interval: "weekly"
allow:
# Allow direct updates only (for packages named in composer.json)
- dependency-type: "direct"
# Allow up to 10 open pull requests for composer dependencies
open-pull-requests-limit: 10
open-pull-requests-limit: 5
versioning-strategy: "increase-if-necessary"
ignore:
- dependency-name: "*"
update-types: [ "version-update:semver-major" ]
groups:
npm-dependencies:
dependency-type: "production"
npm-dev-dependencies:
dependency-type: "development"

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
allow:
- dependency-type: "direct"
open-pull-requests-limit: 10
open-pull-requests-limit: 5
groups:
all-github-actions:
patterns:
- ".*"
32 changes: 0 additions & 32 deletions .github/workflows/autobuild-dependabot-assets.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Prepare Release 🚀

on:
push:
branches:
- dev

jobs:
deploy:
uses: pressbooks/reusable-workflows/.github/workflows/prepare-release.yml@main
secrets: inherit
43 changes: 0 additions & 43 deletions .github/workflows/standards.yml

This file was deleted.

191 changes: 83 additions & 108 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,131 +2,90 @@ name: Run Tests

on:
push:
branches: [dev, production]
tags:
- '*.*.*'
branches: [ dev ]
pull_request:
branches: [dev]
branches: [ dev ]

jobs:
tests:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php: [8.1, 8.2]
os: [ubuntu-20.04]
epubcheck: [4.2.6]
prince: [14.3-1]
wordpress: [6.5, latest]
php: [ 8.1, 8.2 ]
wordpress: [ '6.5', 'latest' ]
experimental: [ false ]
epubcheck: [ 4.2.6 ]
prince: [ 14.3-1 ]
include:
- experimental: true
- experimental: false
php: 8.1
- php: 8.2
wordpress: 6.5
prince: 14.3-1
epubcheck: 4.2.6
experimental: true

name: Test - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}

outputs:
coverage: ${{ matrix.experimental == false }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install OS dependencies
run: |
sudo apt update
sudo apt-get install libxml2-utils ghostscript poppler-utils imagemagick
sudo systemctl start mysql.service
wget https://github.com/w3c/epubcheck/releases/download/v${{ matrix.epubcheck }}/epubcheck-${{ matrix.epubcheck }}.zip
unzip epubcheck-${{ matrix.epubcheck }}.zip -d /opt/
mv /opt/epubcheck-${{ matrix.epubcheck }} /opt/epubcheck
rm epubcheck-${{ matrix.epubcheck }}.zip
wget https://www.princexml.com/download/prince_${{ matrix.prince }}_ubuntu20.04_amd64.deb
sudo dpkg -i prince_${{ matrix.prince }}_ubuntu20.04_amd64.deb
rm prince_${{ matrix.prince }}_ubuntu20.04_amd64.deb
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: vendor
key: ${{ matrix.php }}-php-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP with Composer 2
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
coverage: pcov
extensions: imagick

- name: Install PHP dependencies
run: |
export PATH="$HOME/.composer/vendor/bin:$PATH"
composer install --no-interaction
ulimit -n 4096
- name: Install WP tests
run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }}

- name: Run PHP Tests
run: composer test -- --exclude=integrations
if: matrix.experimental == true

- name: Run PHP Tests and PCOV
run: composer test-coverage -- --exclude=integrations
if: matrix.experimental == false

- name: Save code coverage to artifact
uses: actions/upload-artifact@v4
if: matrix.experimental == false
with:
name: code-coverage
path: "coverage.xml"
retention-days: 5
overwrite: true

- name: Prepare Build
if: startsWith(github.ref, 'refs/tags/') && matrix.experimental == false
run: |
export COMPOSER_MEMORY_LIMIT=-1
export GITHUB_BUILD_PATH=${{github.workspace}}
export GITHUB_REPO_SLUG="$(basename ${{github.workspace}})"
export GITHUB_TAG="$(basename ${{github.ref}})"
echo "File to be created : $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip"
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
wp package install wp-cli/dist-archive-command
npm install
npm run build
composer install --no-dev --optimize-autoloader
cd ..
wp dist-archive $GITHUB_REPO_SLUG $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip
cd $GITHUB_BUILD_PATH
ls $GITHUB_BUILD_PATH
- name: Deploy
if: startsWith(github.ref, 'refs/tags/') && matrix.experimental == false
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files:
${{github.workspace}}/*.zip

- name: Trigger Bedrock Update
if: (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/production') && matrix.experimental == false
uses: pressbooks/composer-autoupdate-bedrock@main
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SNS_ARN_DEV: ${{ secrets.AWS_SNS_ARN_DEV }}
AWS_SNS_ARN_STAGING: ${{ secrets.AWS_SNS_ARN_STAGING }}
INPUT_TRIGGERED_BY: ${{ github.repository }}
BRANCH: ${{ github.ref }}
- name: Checkout code
uses: actions/checkout@v4

- name: Install OS dependencies
run: |
sudo apt update
sudo apt-get install libxml2-utils ghostscript poppler-utils imagemagick
sudo systemctl start mysql.service
wget https://github.com/w3c/epubcheck/releases/download/v${{ matrix.epubcheck }}/epubcheck-${{ matrix.epubcheck }}.zip
unzip epubcheck-${{ matrix.epubcheck }}.zip -d /opt/
mv /opt/epubcheck-${{ matrix.epubcheck }} /opt/epubcheck
rm epubcheck-${{ matrix.epubcheck }}.zip
wget https://www.princexml.com/download/prince_${{ matrix.prince }}_ubuntu20.04_amd64.deb
sudo dpkg -i prince_${{ matrix.prince }}_ubuntu20.04_amd64.deb
rm prince_${{ matrix.prince }}_ubuntu20.04_amd64.deb
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: vendor
key: php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP with Composer 2
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
coverage: pcov
extensions: imagick

- name: Install PHP dependencies
run: |
export PATH="$HOME/.composer/vendor/bin:$PATH"
composer install --no-interaction
ulimit -n 4096
- name: Install WP tests
run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }}

- name: Run PHP Tests
run: composer test -- --exclude=integrations
if: matrix.experimental == true

- name: Run PHP Tests and PCOV
run: composer test-coverage -- --exclude=integrations
if: matrix.experimental == false

- name: Save code coverage to artifact
uses: actions/upload-artifact@v4
if: matrix.experimental == false
with:
name: code-coverage
path: "coverage.xml"
retention-days: 5
overwrite: true

coverage:
runs-on: ubuntu-latest
Expand All @@ -144,3 +103,19 @@ jobs:
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

trigger_bedrock_updates:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Trigger Bedrock Updates
if: github.ref == 'refs/heads/dev'
uses: pressbooks/composer-autoupdate-bedrock@main
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_SNS_ARN_DEV: ${{ secrets.AWS_SNS_ARN_DEV }}
AWS_SNS_ARN_STAGING: ${{ secrets.AWS_SNS_ARN_STAGING }}
INPUT_TRIGGERED_BY: ${{ github.repository }}
REF: ${{ github.ref }}

8 changes: 4 additions & 4 deletions .github/workflows/update-mo.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Update .mo files
name: Update .mo files 🌐

on:
pull_request:
branches: [ dev ]
branches: [dev]
paths:
- 'languages/*.po'
- "languages/*.po"
workflow_dispatch:

jobs:
update-mo-files:
uses: pressbooks/reusable-workflows/.github/workflows/update-mo.yml@dev
uses: pressbooks/reusable-workflows/.github/workflows/update-mo.yml@main
Loading

0 comments on commit 7f05263

Please sign in to comment.