From e34af9c9c3b28eb812a5967a97d23be5449f0308 Mon Sep 17 00:00:00 2001 From: Dennis Oelkers Date: Tue, 19 Sep 2023 12:28:34 +0200 Subject: [PATCH] Replacing previous build. --- .github/workflows/build.yml | 37 +++++++++++++++-- .github/workflows/project-build.yml | 62 ----------------------------- 2 files changed, 33 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/project-build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f236b0375d60..d9b88f4a189b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ -name: Build the repository +name: Build the project -on: +on: pull_request: # Cancel running build when new ref gets pushed. @@ -15,15 +15,44 @@ jobs: matrix: java-version: [ 17 ] steps: + - name: Check if PR author is part of Org + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + # This script checks if the PR author is a member of the organization + script: | + const prAuthor = context.payload.pull_request.user.login; + + const isMember = await github.rest.orgs.checkMembershipForUser({ + org: 'Graylog2', + username: prAuthor, + }); + + if (isMember.status === 204) { + console.log(`PR author ${prAuthor} is a Graylog member.`); + } else { + console.log(`PR author ${prAuthor} is not a Graylog member, skipping project build.`); + core.setFailed('Skipping run because author is not a Graylog member.'); + } - uses: actions/checkout@v4 + with: + repository: Graylog2/graylog-project-internal + token: ${{ secrets.GH_PAT }} - name: Set up JDK ${{ matrix.java-version }} uses: actions/setup-java@v3 with: java-version: ${{ matrix.java-version }} distribution: temurin cache: maven - - name: License check - run: mvn -B --fail-fast license:check + - name: Setup graylog-project binary + run: | + wget -q -O /usr/local/bin/graylog-project https://github.com/Graylog2/graylog-project-cli/releases/download/0.38.1/graylog-project.linux + chmod +x /usr/local/bin/graylog-project + - name: Checkout project + run: | + graylog-project checkout -p $GITHUB_REF manifests/master.json + - name: Build with Maven run: mvn -B --fail-fast -Pedantic -Dspotbugs.skip -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 verify javadoc:javadoc env: diff --git a/.github/workflows/project-build.yml b/.github/workflows/project-build.yml deleted file mode 100644 index 142404e1a36d..000000000000 --- a/.github/workflows/project-build.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build the project - -on: - pull_request: - -# Cancel running build when new ref gets pushed. -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest-4-cores-public - strategy: - matrix: - java-version: [ 17 ] - steps: - - name: Check if PR author is part of Org - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - # This script checks if the PR author is a member of the organization - script: | - const prAuthor = context.payload.pull_request.user.login; - - const isMember = await github.rest.orgs.checkMembershipForUser({ - org: 'Graylog2', - username: prAuthor, - }); - - if (isMember.status === 204) { - console.log(`PR author ${prAuthor} is a Graylog member.`); - } else { - console.log(`PR author ${prAuthor} is not a Graylog member, skipping project build.`); - core.setFailed('Skipping run because author is not a Graylog member.'); - } - - uses: actions/checkout@v4 - with: - repository: Graylog2/graylog-project-internal - token: ${{ secrets.GH_PAT }} - - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java-version }} - distribution: temurin - cache: maven - - name: Setup graylog-project binary - run: | - wget -q -O /usr/local/bin/graylog-project https://github.com/Graylog2/graylog-project-cli/releases/download/0.38.1/graylog-project.linux - chmod +x /usr/local/bin/graylog-project - - name: Checkout project - run: | - graylog-project checkout -p $GITHUB_REF manifests/master.json - - - name: Build with Maven - run: mvn -B --fail-fast -Pedantic -Dspotbugs.skip -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 verify javadoc:javadoc - env: - JAVA_OPTS: -Xmx6G - TIMEOUT_MULTIPLIER: 2.0 - -