This is an automated email from the ASF dual-hosted git repository. jonnybot pushed a commit to branch task/213-github-actions-for-ci in repository https://gitbox.apache.org/repos/asf/groovy-geb.git
commit 09db827c4cabb71680f32c9db7bf58178efcc790 Author: Jonny Carter <[email protected]> AuthorDate: Thu Dec 5 15:52:10 2024 -0600 DRY out the workflows --- .github/workflows/common.yml | 77 ++++++++ .github/workflows/test-workflows.yml | 354 +++-------------------------------- 2 files changed, 106 insertions(+), 325 deletions(-) diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml new file mode 100644 index 00000000..9432cedd --- /dev/null +++ b/.github/workflows/common.yml @@ -0,0 +1,77 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Common Workflow + +on: + workflow_call: + inputs: + gradle_task: + description: 'Gradle task to run' + required: true + type: string + container_image: + description: 'Docker container image' + required: true + type: string + +jobs: + common: + runs-on: ubuntu-latest + container: + image: ${{ inputs.container_image }} + env: + GRADLE_OPTS: -Xmx1024m -XX:MaxMetaspaceSize=256m + GRADLE_USER_HOME: .gradle-home + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Restore Gradle cache + uses: actions/cache@v4 + with: + path: .gradle-home + key: gradle-home-${{ inputs.gradle_task }}-${{ github.ref }} + restore-keys: | + gradle-home-${{ inputs.gradle_task }}-${{ github.ref }} + gradle-home-${{ inputs.gradle_task }}-master + gradle-home-${{ inputs.gradle_task }} + + - name: Run Gradle tasks + run: ./gradlew --no-daemon --max-workers 4 --parallel -Pci ${{ inputs.gradle_task }} + + - name: Copy all test results to a directory + run: | + mkdir -p ~/test-results/junit/ + find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \; + + - name: Store test results + if: success() || failure() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: ~/test-results/ + + - name: Store build reports + uses: actions/upload-artifact@v4 + with: + name: build-reports + path: build/reports + + - name: Save Gradle cache + uses: actions/cache@v4 + with: + path: .gradle-home + key: gradle-home-${{ inputs.gradle_task }}-${{ github.ref }}-${{ github.run_id }} diff --git a/.github/workflows/test-workflows.yml b/.github/workflows/test-workflows.yml index 82211204..e07fd109 100644 --- a/.github/workflows/test-workflows.yml +++ b/.github/workflows/test-workflows.yml @@ -24,339 +24,43 @@ on: jobs: check: - runs-on: ubuntu-latest - container: - image: eclipse-temurin:21-jdk - env: - GRADLE_OPTS: -Xmx1024m -XX:MaxMetaspaceSize=256m - GRADLE_USER_HOME: .gradle-home - steps: - - name: Checkout code - uses: actions/checkout@v4 + uses: ./.github/workflows/common.yml + with: + gradle_task: 'module:check internal:check integration:check doc:site:check --continue' + container_image: 'eclipse-temurin:21-jdk' - - name: Restore Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-check-${{ github.ref }} - restore-keys: | - gradle-home-check-${{ github.ref }} - gradle-home-check-master - gradle-home-check - - - name: Run Gradle tasks - run: ./gradlew --no-daemon --max-workers 4 --parallel -Pci module:check internal:check integration:check doc:site:check --continue - - - name: Copy all test results to a directory - run: | - mkdir -p ~/test-results/junit/ - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \; - - - name: Store test results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ~/test-results/ - - - name: Store build reports - uses: actions/upload-artifact@v4 - with: - name: build-reports - path: build/reports - - - name: Save Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-check-${{ github.ref }}-${{ github.run_id }} dockerised-cross-browser: - runs-on: ubuntu-latest - container: - image: eclipse-temurin:21-jdk - env: - GRADLE_OPTS: -Xmx1024m -XX:MaxMetaspaceSize=256m - GRADLE_USER_HOME: .gradle-home - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Docker - uses: docker/setup-buildx-action@v4 - - - name: Restore Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-dockerised-crossbrowser-${{ github.ref }} - restore-keys: | - gradle-home-dockerised-crossbrowser-${{ github.ref }} - gradle-home-dockerised-crossbrowser-master - gradle-home-dockerised-crossbrowser - - - name: Run Gradle tasks - run: ./gradlew --no-daemon --max-workers 4 --parallel -Pci allDockerisedCrossBrowserTests - - - name: Copy all test results to a directory - run: | - mkdir -p ~/test-results/junit/ - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \; - - - name: Store test results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ~/test-results/ + uses: ./.github/workflows/common.yml + with: + gradle_task: 'allDockerisedCrossBrowserTests' + container_image: 'eclipse-temurin:21-jdk' - - name: Store build reports - uses: actions/upload-artifact@v4 - with: - name: build-reports - path: build/reports - - - name: Save Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-dockerised-crossbrowser-${{ github.ref }}-${{ github.run_id }} manual: - runs-on: ubuntu-latest - container: - image: selenium/standalone-firefox - env: - GRADLE_OPTS: -Xmx1024m -XX:MaxMetaspaceSize=256m - GRADLE_USER_HOME: .gradle-home - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Docker - uses: docker/setup-buildx-action@v4 - - - name: Restore Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-manual-machine-${{ github.ref }} - restore-keys: | - gradle-home-manual-machine-${{ github.ref }} - gradle-home-manual-machine-master - gradle-home-manual-machine - - - name: Run Gradle tasks - run: | - Xvfb :99 -screen 1 1280x1024x16 -nolisten tcp > /dev/null 2>&1 & - ./gradlew --no-daemon --max-workers 4 --parallel -Pci :doc:manual-snippets:check :doc:manual-snippets:fixtures:check :doc:manual-snippets:real-browser:check :doc:manual:build :doc:asciidoctor-extension:check - - - name: Copy all test results to a directory - run: | - mkdir -p ~/test-results/junit/ - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \; + uses: ./.github/workflows/common.yml + with: + gradle_task: ':doc:manual-snippets:check :doc:manual-snippets:fixtures:check :doc:manual-snippets:real-browser:check :doc:manual:build :doc:asciidoctor-extension:check' + container_image: 'selenium/standalone-firefox' - - name: Store test results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ~/test-results/ - - - name: Store build reports - uses: actions/upload-artifact@v4 - with: - name: build-reports - path: build/reports - - - name: Save Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-manual-machine-${{ github.ref }}-${{ github.run_id }} local-cross-browser: - runs-on: ubuntu-latest - container: - image: selenium/standalone-chromium - env: - GRADLE_OPTS: -Xmx1024m -XX:MaxMetaspaceSize=256m - GRADLE_USER_HOME: .gradle-home - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Restore Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-local-crossbrowser-${{ github.ref }} - restore-keys: | - gradle-home-local-crossbrowser-${{ github.ref }} - gradle-home-local-crossbrowser-master - gradle-home-local-crossbrowser - - - name: Run Gradle tasks - run: ./gradlew --no-daemon --max-workers 4 --parallel -p module -Pci localChromeTest + uses: ./.github/workflows/common.yml + with: + gradle_task: 'localChromeTest' + container_image: 'selenium/standalone-chromium' - - name: Copy all test results to a directory - run: | - mkdir -p ~/test-results/junit/ - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \; + saucelabs: + uses: ./.github/workflows/common.yml + with: + gradle_task: 'allSauceLabsTests' + container_image: 'eclipse-temurin:21-jdk' - - name: Store test results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ~/test-results/ - - - name: Store build reports - uses: actions/upload-artifact@v4 - with: - name: build-reports - path: build/reports - - - name: Save Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-local-crossbrowser-${{ github.ref }}-${{ github.run_id }} - saucelabs: - runs-on: ubuntu-latest - container: - image: eclipse-temurin:21-jdk - env: - GRADLE_OPTS: -Xmx1024m -XX:MaxMetaspaceSize=256m - GRADLE_USER_HOME: .gradle-home - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Restore Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-saucelabs-${{ github.ref }} - restore-keys: | - gradle-home-saucelabs-${{ github.ref }} - gradle-home-saucelabs-master - gradle-home-saucelabs - - - name: Run Gradle tasks - run: ./gradlew --no-daemon -Pci --max-workers 5 --parallel allSauceLabsTests - - - name: Copy all test results to a directory - run: | - mkdir -p ~/test-results/junit/ - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \; - - - name: Store test results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ~/test-results/ - - - name: Store build reports - uses: actions/upload-artifact@v4 - with: - name: build-reports - path: build/reports - - - name: Save Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-saucelabs-${{ github.ref }}-${{ github.run_id }} non-ie: - runs-on: ubuntu-latest - container: - image: eclipse-temurin:21-jdk - env: - GRADLE_OPTS: -Xmx1024m -XX:MaxMetaspaceSize=256m - GRADLE_USER_HOME: .gradle-home - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Restore Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-non-ie-${{ github.ref }} - restore-keys: | - gradle-home-non-ie-${{ github.ref }} - gradle-home-non-ie-master - gradle-home-non-ie - - - name: Run Gradle tasks - run: ./gradlew --no-daemon -Pci --max-workers 5 --parallel nonIeBrowserStackTests + uses: ./.github/workflows/common.yml + with: + gradle_task: 'nonIeBrowserStackTests' + container_image: 'eclipse-temurin:21-jdk' - - name: Copy all test results to a directory - run: | - mkdir -p ~/test-results/junit/ - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \; - - - name: Store test results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ~/test-results/ - - - name: Store build reports - uses: actions/upload-artifact@v4 - with: - name: build-reports - path: build/reports - - - name: Save Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-non-ie-${{ github.ref }}-${{ github.run_id }} ie: - runs-on: ubuntu-latest - container: - image: eclipse-temurin:21-jdk - env: - GRADLE_OPTS: -Xmx1024m -XX:MaxMetaspaceSize=256m - GRADLE_USER_HOME: .gradle-home - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Restore Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-ie-${{ github.ref }} - restore-keys: | - gradle-home-ie-${{ github.ref }} - gradle-home-ie-master - gradle-home-ie - - - name: Run Gradle tasks - run: ./gradlew --no-daemon -Pci --max-workers 5 --parallel ieBrowserStackTests - - - name: Copy all test results to a directory - run: | - mkdir -p ~/test-results/junit/ - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/test-results/junit/ \; - - - name: Store test results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-results - path: ~/test-results/ - - - name: Store build reports - uses: actions/upload-artifact@v4 - with: - name: build-reports - path: build/reports - - - name: Save Gradle cache - uses: actions/cache@v4 - with: - path: .gradle-home - key: gradle-home-ie-${{ github.ref }}-${{ github.run_id }} + uses: ./.github/workflows/common.yml + with: + gradle_task: 'ieBrowserStackTests' + container_image: 'eclipse-temurin:21-jdk'
