|
| 1 | +name: Verify and Release on tags |
| 2 | + |
| 3 | +# trigger on push to branches and PR |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - '**' # matches every branch |
| 8 | + tags: |
| 9 | + - 'v[0-9]+' |
| 10 | + - 'v[0-9]+.[0-9]+' |
| 11 | + - 'v[0-9]+.[0-9]+.[0-9]+' |
| 12 | + pull_request: |
| 13 | + |
| 14 | +jobs: |
| 15 | + lint_shellcheck: |
| 16 | + name: shellcheck |
| 17 | + runs-on: ubuntu-latest |
| 18 | + # execute on any push or pull request from forked repo |
| 19 | + if: github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork ) |
| 20 | + env: |
| 21 | + SHELLCHECK_VERSION: '0.10.0' |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: download shellcheck |
| 26 | + run: | |
| 27 | + curl --silent --fail --show-error --retry 2 --retry-delay 1 --connect-timeout 5 --location --url "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" -o shellcheck-v${SHELLCHECK_VERSION}.tar.xz |
| 28 | + tar xvf "shellcheck-v${SHELLCHECK_VERSION}.tar.xz" |
| 29 | + rm -f "shellcheck-v${SHELLCHECK_VERSION}.tar.xz" |
| 30 | + chmod +x "$GITHUB_WORKSPACE/shellcheck-v${SHELLCHECK_VERSION}/shellcheck" |
| 31 | +
|
| 32 | + - name: check |
| 33 | + run: | |
| 34 | + echo "$GITHUB_WORKSPACE/shellcheck-v${SHELLCHECK_VERSION}" >> $GITHUB_PATH |
| 35 | + shellcheck core/bin/hbox-* core/sbin/start-history-server.sh core/libexec/hbox-common-env.sh |
| 36 | + find tests -name '*.sh' | xargs shellcheck |
| 37 | +
|
| 38 | + lint_maven: |
| 39 | + name: lint pom.xml and maven plugins |
| 40 | + runs-on: ubuntu-latest |
| 41 | + # execute on any push or pull request from forked repo |
| 42 | + if: github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork ) |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + - name: Set up JDK |
| 46 | + uses: actions/setup-java@v4 |
| 47 | + with: |
| 48 | + java-version: 11 |
| 49 | + distribution: 'temurin' |
| 50 | + cache: maven |
| 51 | + - name: Lint Maven Pom Format |
| 52 | + run: ./mvnw -V -B -ntp sortpom:verify -Dsort.verifyFail=STOP |
| 53 | + - name: Lint Check Maven Plugins |
| 54 | + run: ./mvnw -B -ntp artifact:check-buildplan |
| 55 | + |
| 56 | + verify: |
| 57 | + name: 'Verify with JDK ${{ matrix.jdk }}' |
| 58 | + strategy: |
| 59 | + fail-fast: false |
| 60 | + matrix: |
| 61 | + jdk: [ 8, 11, 17 ] |
| 62 | + runs-on: ubuntu-latest |
| 63 | + # execute on any push or pull request from forked repo |
| 64 | + if: github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork ) |
| 65 | + needs: [ lint_shellcheck, lint_maven ] |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + - name: Set up JDK |
| 69 | + uses: actions/setup-java@v4 |
| 70 | + with: |
| 71 | + java-version: '${{ matrix.jdk }}' |
| 72 | + distribution: 'temurin' |
| 73 | + cache: maven |
| 74 | + |
| 75 | + - name: Maven verify |
| 76 | + if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} |
| 77 | + run: ./mvnw -B -ntp -e verify |
| 78 | + |
| 79 | + - name: Maven verify and check reproducible on tags |
| 80 | + if: startsWith(github.ref, 'refs/tags/v') |
| 81 | + shell: bash |
| 82 | + run: | |
| 83 | + set -ux |
| 84 | + ./mvnw -B -ntp -e install -Dbuildinfo.detect.skip=false |
| 85 | + ./mvnw -B -ntp -e clean |
| 86 | + mkdir -p target |
| 87 | +
|
| 88 | + true artifact:compare should not contain warning or error |
| 89 | + trap 'cat target/build.log' ERR |
| 90 | + ./mvnw -B -ntp -e -l target/build.log package artifact:compare -Dmaven.test.skip=true -DskipTests -Dinvoker.skip -Dbuildinfo.detect.skip=false |
| 91 | +
|
| 92 | + test 0 = "$(sed -n '/^\\[INFO\\] --- maven-artifact-plugin:[^:][^:]*:compare/,/^\\[INFO\\] ---/ p' target/build.log | grep -c '^\\[\\(WARNING\\|ERROR\\)\\]')" |
| 93 | +
|
| 94 | + true all files should be ok |
| 95 | + trap 'find . -name "*.buildcompare" -print0 | xargs -0 cat' ERR |
| 96 | + find . -name '*.buildcompare' -print0 | xargs -0 grep -q '^ko=0$' |
| 97 | + trap '' ERR |
| 98 | +
|
| 99 | + find . -name "*.buildcompare" -print0 | xargs -0 cat |
0 commit comments