From 49889130fa5292ed06d295f4926322dd87ad0b72 Mon Sep 17 00:00:00 2001 From: Stephen Cox Date: Fri, 9 Aug 2024 15:14:03 +0100 Subject: [PATCH 1/3] Use shared workflow for GitHub testing --- .github/workflows/localgov_microsites.yml | 214 ---------------------- .github/workflows/test.yml | 17 ++ 2 files changed, 17 insertions(+), 214 deletions(-) delete mode 100644 .github/workflows/localgov_microsites.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/localgov_microsites.yml b/.github/workflows/localgov_microsites.yml deleted file mode 100644 index 09dae7f..0000000 --- a/.github/workflows/localgov_microsites.yml +++ /dev/null @@ -1,214 +0,0 @@ -## -# Managed by https://github.com/localgovdrupal/github_workflow_manager ---- -name: Test LocalGov Microsites localgovdrupal/localgov_microsites drupal-profile - -on: - push: - branches: - - '4.x' - pull_request: - branches: - - '4.x' - -env: - LOCALGOV_DRUPAL_PROJECT: localgovdrupal/localgov_microsites - LOCALGOV_DRUPAL_PROJECT_PATH: web/profiles/contrib/localgov_microsites - -jobs: - - build: - name: Install LocalGov Microsites - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - localgov-version: - - '4.x' - drupal-version: - - '~10.0' - php-version: - - '8.1' - - '8.2' - - steps: - - - name: Save git branch and git repo names to env if this is not a pull request - if: github.event_name != 'pull_request' - run: | - echo "GIT_BASE=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV - echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV - echo "HEAD_USER=localgovdrupal" >> $GITHUB_ENV - - - name: Save git branch and git repo names to env if this is a pull request - if: github.event_name == 'pull_request' - run: | - echo "GIT_BASE=${GITHUB_BASE_REF}" >> $GITHUB_ENV - echo "GIT_BRANCH=${GITHUB_HEAD_REF}" >> $GITHUB_ENV - export HEAD="${{ github.event.pull_request.head.label }}" - echo "HEAD_USER=${HEAD%%:*}" >> $GITHUB_ENV - - - name: Set composer branch reference for version branches - if: endsWith(github.ref, '.x') - run: echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV - - - name: Set composer branch reference for non-version branches - if: endsWith(github.ref, '.x') == false - run: echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV - - - name: Get the latest tagged release for branch version - run: | - LATEST_RELEASE=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${GITHUB_REPOSITORY}/git/matching-refs/tags/${GIT_BASE%'.x'} | grep -Po '(?<=refs/tags/)[^"]+' | tail -1) - if [ -z $LATEST_RELEASE ]; then LATEST_RELEASE=${{ matrix.localgov-version }}-dev; fi - echo "LATEST_RELEASE=${LATEST_RELEASE}" >> $GITHUB_ENV - - - name: Cached workspace - uses: actions/cache@v2 - with: - path: ./html - key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - - - name: Clone drupal_container - uses: actions/checkout@v2 - with: - repository: localgovdrupal/drupal-container - ref: php${{ matrix.php-version }} - - - name: Create LocalGov Microsites project - run: | - composer create-project --stability dev --no-install localgovdrupal/localgov_microsites_project ./html "${{ matrix.localgov-version }}" - composer --working-dir=./html require --no-install localgovdrupal/localgov_microsites:${{ matrix.localgov-version }}-dev - composer --working-dir=./html require --no-install drupal/core-recommended:${{ matrix.drupal-version }} drupal/core-composer-scaffold:${{ matrix.drupal-version }} drupal/core-project-message:${{ matrix.drupal-version }} drupal/core-dev:${{ matrix.drupal-version }} - composer --working-dir=./html install - - - name: Obtain the test target using Composer - if: env.HEAD_USER == 'localgovdrupal' - run: | - composer --working-dir=html config repositories.1 vcs git@github.com:${LOCALGOV_DRUPAL_PROJECT}.git - composer global config github-oauth.github.com ${{ github.token }} - composer --working-dir=./html require --with-all-dependencies ${LOCALGOV_DRUPAL_PROJECT}:"${COMPOSER_REF} as ${LATEST_RELEASE}" - - - name: Obtain the test target using Git - if: env.HEAD_USER != 'localgovdrupal' - uses: actions/checkout@v2 - with: - path: ${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }} - - phpcs: - name: Coding standards checks - needs: build - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - localgov-version: - - '4.x' - drupal-version: - - '~10.0' - php-version: - - '8.1' - - '8.2' - - steps: - - - name: Cached workspace - uses: actions/cache@v2 - with: - path: ./html - key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }} - restore-keys: | - localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - - - name: Run coding standards checks - run: | - cd html - ./bin/phpcs -p ${LOCALGOV_DRUPAL_PROJECT_PATH} - - phpstan: - name: Deprecated code checks - needs: build - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - localgov-version: - - '4.x' - drupal-version: - - '~10.0' - php-version: - - '8.1' - - '8.2' - - steps: - - - name: Cached workspace - uses: actions/cache@v2 - with: - path: ./html - key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }} - restore-keys: | - localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - - - name: Run deprecated code checks - run: | - cd html - ./bin/phpstan analyse -c ./phpstan.neon ${LOCALGOV_DRUPAL_PROJECT_PATH} - phpunit: - name: PHPUnit tests - needs: build - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - localgov-version: - - '4.x' - drupal-version: - - '~10.0' - php-version: - - '8.1' - - '8.2' - - steps: - - - name: Clone Drupal container - uses: actions/checkout@v2 - with: - repository: localgovdrupal/drupal-container - ref: php${{ matrix.php-version }} - - - name: Cached workspace - uses: actions/cache@v2 - with: - path: ./html - key: localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}-${{ github.run_id }}-${{ secrets.CACHE_VERSION }} - restore-keys: | - localgov-build-${{ matrix.localgov-version }}-${{ matrix.drupal-version }}-${{ matrix.php-version }}- - - - name: Start Docker environment - run: docker-compose -f docker-compose.yml up -d - - - name: Run PHPUnit tests - run: | - mkdir -p ./html/web/sites/simpletest && chmod 777 ./html/web/sites/simpletest - sed -i "s#http://localgov.lndo.site#http://drupal#" ./html/phpunit.xml.dist - docker exec -t drupal bash -c 'chown docker:docker -R /var/www/html' - docker exec -u docker -t drupal bash -c "cd /var/www/html && ./bin/paratest --processes=4 /var/www/html/${{ env.LOCALGOV_DRUPAL_PROJECT_PATH }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a39cd80 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,17 @@ +name: Test LocalGov Microsites localgovdrupal/localgov_microsites drupal-profile + +on: + push: + branches: + - '4.x' + pull_request: + branches: + - '4.x' + workflow_dispatch: + +jobs: + tests: + uses: localgovdrupal/localgov_shared_workflows/.github/workflows/test-microsites.yml@1.x + with: + project: 'localgovdrupal/localgov_microsites' + project_path: 'web/profiles/contrib/localgov_microsites' From bbad0b93b5e883f9565bc168ed1c19d1d155302b Mon Sep 17 00:00:00 2001 From: Finn Lewis Date: Tue, 20 Aug 2024 11:11:29 +0100 Subject: [PATCH 2/3] Update README.md with working badges. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 98f1dca..d7d27f5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -![Latest Stable Version](https://packagist.org/packages/localgovdrupal/localgov_microsites) ![License](https://github.com/localgovdrupal/localgov_microsites/blob/4.x/LICENSE) ![Tests](https://github.com/localgovdrupal/localgov_microsites/actions/workflows/test.yml/badge.svg) +![GitHub Release](https://img.shields.io/github/v/release/localgovdrupal/localgov_microsites) + ![GitHub License](https://img.shields.io/github/license/localgovdrupal/localgov_microsites) + ![Tests](https://github.com/localgovdrupal/localgov_microsites/actions/workflows/test.yml/badge.svg) # LocalGov Drupal Microsites From 2e4e549304a2d336c0d8055d6b1d846023311fe8 Mon Sep 17 00:00:00 2001 From: Stephen Cox Date: Tue, 17 Sep 2024 12:44:27 +0100 Subject: [PATCH 3/3] Update dependencies for stable 4.0.0 relese #483 --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 081241d..f5d92fb 100644 --- a/composer.json +++ b/composer.json @@ -25,10 +25,10 @@ "drupal/responsive_preview": "^2.1", "localgovdrupal/localgov_blogs": "^1.0.0-beta3", "localgovdrupal/localgov_core": "^2.12", - "localgovdrupal/localgov_directories": "^3.0@alpha", - "localgovdrupal/localgov_events": "^3.0@alpha", - "localgovdrupal/localgov_microsites_group": "^4.0@beta", - "localgovdrupal/localgov_microsites_base": "^2.0@beta", + "localgovdrupal/localgov_directories": "^3.1", + "localgovdrupal/localgov_events": "^3.0", + "localgovdrupal/localgov_microsites_group": "^4.0", + "localgovdrupal/localgov_microsites_base": "^2.0", "localgovdrupal/localgov_microsites_colour_picker_fields": "^1.0.0-beta1", "localgovdrupal/localgov_news": "^2.3", "localgovdrupal/localgov_page": "^1.0.0-beta2",