This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch extract-verify-steps in repository https://gitbox.apache.org/repos/asf/maven-gh-actions-shared.git
commit 189c7d267d3d3c401a86255ee2d5fdd5519f28dc Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Sat May 11 15:35:24 2024 +0200 Extract verify steps to separate action - preparation for Maven 4 It allows us to use next verify job with Maven 4 --- .github/actions/verify/action.yml | 116 +++++++++++++++++++++++++++++++++++++ .github/workflows/maven-verify.yml | 76 +++--------------------- 2 files changed, 124 insertions(+), 68 deletions(-) diff --git a/.github/actions/verify/action.yml b/.github/actions/verify/action.yml new file mode 100644 index 0000000..60eb536 --- /dev/null +++ b/.github/actions/verify/action.yml @@ -0,0 +1,116 @@ +# 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: 'Verify' +description: 'Shared steps for verify' +inputs: + install-mercurial: + required: true + + install-gpg: + required: true + + jdk: + required: true + + distribution: + required: true + + maven: + required: true + + maven-args: + required: true + + verify-goal: + required: true + + failure-upload-path: + required: true + +runs: + using: composite + + steps: + # Some projects (like Maven SCM) need the command-line tools for all SCMs installed. + # Git and Subversion are installed on all by default. + # Mercurial is not installed on macOS. + # https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners#installing-software-on-macos-runners + - name: Install Mercurial (hg) on macOS + if: > + inputs.install-mercurial && + runner.os == 'macOS' + shell: bash + run: | + brew install mercurial + + - name: Install GnuPG + if: > + inputs.install-gpg && + runner.os == 'Windows' + shell: pwsh + run: | + $env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin" + [Environment]::SetEnvironmentVariable("Path", $env:PATH, "Machine") + choco install --yes gpg4win + echo "C:\Program Files (x86)\Gpg4win\..\GnuPG\bin" >> $env:GITHUB_PATH + + - name: Check GnuPG + if: > + inputs.install-gpg + shell: bash + run: gpg --version + + - name: Show free disk space + shell: bash + run: df -h + + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ inputs.jdk }} + distribution: ${{ inputs.distribution }} + cache: 'maven' + + - name: Set up Maven + shell: bash + run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.1:wrapper "-Dmaven=${{ inputs.maven }}" + + - name: Build with Maven + shell: bash + run: ./mvnw --errors --batch-mode --show-version ${{ inputs.maven-args }} ${{ inputs.verify-goal }} + + - name: Upload artifact on failure + uses: actions/upload-artifact@v4 + if: failure() && inputs.failure-upload-path != '' + with: + name: ${{ github.run_number }}-failure-${{ runner.os }}-${{ inputs.jdk }}-${{ inputs.distribution }} + path: ${{ inputs.failure-upload-path }} + + - name: Show free disk space + if: always() + shell: bash + run: df -h + + - name: Clean Ensuring no file handle remains open on windows + shell: bash + run: ./mvnw clean --errors --batch-mode --show-version diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml index aaaf0cc..d3f6937 100644 --- a/.github/workflows/maven-verify.yml +++ b/.github/workflows/maven-verify.yml @@ -256,74 +256,14 @@ jobs: inputs.verify-goal != inputs.ff-goal run: echo ok - # Some projects (like Maven SCM) need the command-line tools for all SCMs installed. - # Git and Subversion are installed on all by default. - # Mercurial is not installed on macOS. - # https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners#installing-software-on-macos-runners - - name: Install Mercurial (hg) on macOS - if: > - inputs.install-mercurial && - steps.should-run.conclusion == 'success' && - matrix.os == 'macos-latest' - run: | - brew install mercurial - - - name: Install GnuPG - if: > - inputs.install-gpg && - steps.should-run.conclusion == 'success' && - matrix.os == 'windows-latest' - run: | - $env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin" - [Environment]::SetEnvironmentVariable("Path", $env:PATH, "Machine") - choco install --yes gpg4win - echo "C:\Program Files (x86)\Gpg4win\..\GnuPG\bin" >> $env:GITHUB_PATH - - - name: Check GnuPG - if: > - inputs.install-gpg && - steps.should-run.conclusion == 'success' - run: gpg --version - - - name: Show free disk space + - uses: apache/maven-gh-actions-shared/.github/actions/verify@extract-verify-steps if: steps.should-run.conclusion == 'success' - run: df -h - shell: bash - - - name: Checkout - if: steps.should-run.conclusion == 'success' - uses: actions/checkout@v4 with: - persist-credentials: false - - - name: Set up JDK - if: steps.should-run.conclusion == 'success' - uses: actions/setup-java@v4 - with: - java-version: ${{ matrix.jdk }} + install-mercurial: ${{ inputs.install-mercurial }} + install-gpg: ${{ inputs.install-gpg }} + jdk: ${{ matrix.jdk }} distribution: ${{ matrix.distribution }} - cache: 'maven' - - - name: Set up Maven - if: steps.should-run.conclusion == 'success' - run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.2.0:wrapper "-Dmaven=${{ matrix.maven }}" - - - name: Build with Maven - if: steps.should-run.conclusion == 'success' - run: ./mvnw --errors --batch-mode --show-version ${{ inputs.maven-args }} ${{ inputs.verify-goal }} - - - name: Upload artifact on failure - uses: actions/upload-artifact@v4 - if: steps.should-run.conclusion == 'success' && failure() && inputs.failure-upload-path != '' - with: - name: ${{ github.run_number }}-failure-${{ matrix.os }}-${{ matrix.jdk }}-${{ matrix.distribution }} - path: ${{ inputs.failure-upload-path }} - - - name: Show free disk space - if: steps.should-run.conclusion == 'success' && always() - run: df -h - shell: bash - - - name: Clean Ensuring no file handle remains open on windows - if: steps.should-run.conclusion == 'success' - run: ./mvnw clean --errors --batch-mode --show-version + maven: ${{ matrix.maven }} + maven-args: ${{ inputs.maven-args }} + verify-goal: ${{ inputs.verify-goal }} + failure-upload-path: ${{ inputs.failure-upload-path }}