|
1 | | -name: build |
| 1 | +name: Build |
2 | 2 |
|
3 | 3 | on: |
| 4 | + pull_request: |
| 5 | + merge_group: |
4 | 6 | push: |
5 | 7 | branches: |
6 | | - - main |
| 8 | + - '**' |
| 9 | + # don't run on dependabot branches. Dependabot will create pull requests, which will then be run instead |
| 10 | + - '!dependabot/**' |
7 | 11 | tags: |
8 | 12 | - '**' |
9 | | - pull_request: |
| 13 | + workflow_dispatch: |
10 | 14 | schedule: |
11 | 15 | # build it monthly: At 04:15 on day-of-month 1. |
12 | 16 | - cron: '15 4 1 * *' |
13 | 17 | # for testing the event "schedule": run every 15 minutes starting from minute 5 through 59 (0, 15, 30, 45) |
14 | 18 | #- cron: '0/15 * * * *' |
15 | | - workflow_dispatch: |
| 19 | + |
| 20 | +# if another commit is added to the same branch or PR (same github.ref), |
| 21 | +# then cancel already running jobs and start a new build. |
| 22 | +concurrency: |
| 23 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read # to fetch code (actions/checkout) |
| 28 | + |
| 29 | +env: |
| 30 | + LANG: 'en_US.UTF-8' |
16 | 31 |
|
17 | 32 | jobs: |
18 | | - build: |
19 | | - runs-on: ${{ matrix.os }} |
20 | | - continue-on-error: false |
21 | | - strategy: |
22 | | - matrix: |
23 | | - os: [ ubuntu-latest, windows-latest, macos-latest ] |
24 | | - if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} |
| 33 | + compile: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + timeout-minutes: 10 |
| 36 | + defaults: |
| 37 | + run: |
| 38 | + shell: bash |
25 | 39 | steps: |
26 | | - - uses: actions/checkout@v4 |
27 | | - - uses: actions/cache@v4 |
28 | | - with: |
29 | | - path: | |
30 | | - ~/.m2/repository |
31 | | - ~/.cache |
32 | | - key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }} |
33 | | - restore-keys: | |
34 | | - ${{ runner.os }}- |
35 | | - - name: Set up Ruby 3.3 |
36 | | - uses: ruby/setup-ruby@v1 |
37 | | - with: |
38 | | - ruby-version: 3.3 |
39 | | - - name: Setup Environment |
40 | | - shell: bash |
41 | | - run: | |
42 | | - echo "LANG=en_US.UTF-8" >> $GITHUB_ENV |
43 | | - echo "MAVEN_OPTS=-Daether.connector.http.connectionMaxTtl=180 -DautoReleaseAfterClose=true" >> $GITHUB_ENV |
44 | | - echo "PMD_CI_SCRIPTS_URL=https://raw.githubusercontent.com/pmd/build-tools/main/scripts" >> $GITHUB_ENV |
45 | | - - name: Check Environment |
46 | | - shell: bash |
47 | | - run: | |
48 | | - f=check-environment.sh; \ |
49 | | - mkdir -p .ci && \ |
50 | | - ( [ -e .ci/$f ] || curl -sSL "${PMD_CI_SCRIPTS_URL}/$f" > ".ci/$f" ) && \ |
51 | | - chmod 755 .ci/$f && \ |
52 | | - .ci/$f |
53 | | - - name: Build |
54 | | - run: .ci/build.sh |
55 | | - shell: bash |
56 | | - env: |
57 | | - PMD_CI_SECRET_PASSPHRASE: ${{ secrets.PMD_CI_SECRET_PASSPHRASE }} |
58 | | - PMD_CI_GPG_PRIVATE_KEY: ${{ secrets.PMD_CI_GPG_PRIVATE_KEY }} |
59 | | - MAVEN_GPG_PASSPHRASE: ${{ secrets.PMD_CI_GPG_PASSPHRASE }} |
60 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + - uses: actions/setup-java@v4 |
| 42 | + with: |
| 43 | + distribution: 'temurin' |
| 44 | + java-version: '11' |
| 45 | + - uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + key: maven-${{ hashFiles('**/pom.xml') }} |
| 48 | + restore-keys: maven- |
| 49 | + path: .m2/repository |
| 50 | + enableCrossOsArchive: true |
| 51 | + - name: Build with Maven |
| 52 | + run: | |
| 53 | + ./mvnw --show-version --errors --batch-mode \ |
| 54 | + -Dmaven.repo.local=.m2/repository \ |
| 55 | + verify |
| 56 | + - uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: compile-artifact |
| 59 | + if-no-files-found: error |
| 60 | + path: | |
| 61 | + target/ |
0 commit comments