|
1 | | -name: "CodeQL" |
| 1 | +name: CodeQL |
2 | 2 |
|
3 | 3 | on: |
4 | | - - push |
5 | | - - workflow_dispatch |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
6 | 7 |
|
7 | 8 | jobs: |
8 | 9 | analyze: |
9 | | - name: Analyze |
10 | | - runs-on: ubuntu-latest |
11 | | - strategy: |
12 | | - fail-fast: false |
13 | | - matrix: |
14 | | - java-version: |
15 | | - - 11 |
16 | | - java-distribution: |
17 | | - - adopt |
18 | | - language: ['java'] |
19 | | - steps: |
20 | | - - name: Checkout killbill-client-java |
21 | | - uses: actions/checkout@v2 |
22 | | - with: |
23 | | - repository: killbill/killbill-client-java |
24 | | - ref: ${{ github.ref }} |
25 | | - path: killbill-client-java |
26 | | - # We must fetch at least the immediate parents so that if this is |
27 | | - # a pull request then we can checkout the head. |
28 | | - fetch-depth: 2 |
29 | | - # If this run was triggered by a pull request event, then checkout |
30 | | - # the head of the pull request instead of the merge commit. |
31 | | - - run: git checkout HEAD^2 |
32 | | - if: ${{ github.event_name == 'pull_request' }} |
33 | | - - name: Setup Java |
34 | | - uses: actions/setup-java@v2 |
35 | | - with: |
36 | | - distribution: ${{ matrix.java-distribution }} |
37 | | - java-version: ${{ matrix.java-version }} |
38 | | - - name: Configure Sonatype mirror |
39 | | - uses: s4u/maven-settings-action@v2.3.0 |
40 | | - # Go to Sonatype directly to avoid delay syncs (could get rid of this if actions/setup-java were to support mirrors). |
41 | | - with: |
42 | | - mirrors: '[{"id": "oss-releases", "name": "Sonatype releases", "mirrorOf": "*", "url": "https://oss.sonatype.org/content/repositories/releases/"}]' |
43 | | - - name: Check if killbill-oss-parent SNAPSHOT must be fetched |
44 | | - id: killbill-oss-parent |
45 | | - run: | |
46 | | - REMOTE_SHA=$(git ls-remote --heads https://github.com/killbill/killbill-oss-parent.git ${GITHUB_REF##*/}) |
47 | | - echo "killbill-oss-parent branch=${GITHUB_REF##*/} sha=${REMOTE_SHA}" |
48 | | - cd $GITHUB_WORKSPACE/killbill-client-java |
49 | | - # Cannot use mvn help:evaluate unfortunately, as the project isn't buildable yet |
50 | | - PARENT_POM_VERSION=$( |
51 | | - awk ' |
52 | | - /<dependenc/{exit} |
53 | | - /<parent>/{parent++}; |
54 | | - /<version>/{ |
55 | | - if (parent == 1) { |
56 | | - sub(/.*<version>/, ""); |
57 | | - sub(/<.*/, ""); |
58 | | - parent_version = $0; |
59 | | - } |
60 | | - } |
61 | | - /<\/parent>/{parent--}; |
62 | | - END { |
63 | | - print parent_version |
64 | | - }' pom.xml |
65 | | - ) |
66 | | - echo "killbill-oss-parent version=${PARENT_POM_VERSION}" |
67 | | - if [[ "$PARENT_POM_VERSION" =~ .*"-SNAPSHOT".* ]] && [ ! -z "$REMOTE_SHA" ]; then |
68 | | - echo "::set-output name=FETCH_SNAPSHOT::true" |
69 | | - else |
70 | | - echo "::set-output name=FETCH_SNAPSHOT::false" |
71 | | - fi |
72 | | - - name: Checkout killbill-oss-parent |
73 | | - if: steps.killbill-oss-parent.outputs.FETCH_SNAPSHOT == 'true' |
74 | | - uses: actions/checkout@v2 |
75 | | - with: |
76 | | - repository: killbill/killbill-oss-parent |
77 | | - ref: ${{ github.ref }} |
78 | | - path: killbill-oss-parent |
79 | | - - name: Build killbill-oss-parent |
80 | | - if: steps.killbill-oss-parent.outputs.FETCH_SNAPSHOT == 'true' |
81 | | - run: | |
82 | | - cd $GITHUB_WORKSPACE/killbill-oss-parent |
83 | | - mvn ${MAVEN_FLAGS} clean install -DskipTests=true |
84 | | - - name: Initialize CodeQL |
85 | | - uses: github/codeql-action/init@v1 |
86 | | - with: |
87 | | - languages: ${{ matrix.language }} |
88 | | - source-root: killbill-client-java |
89 | | - - name: Build killbill-client-java |
90 | | - run: | |
91 | | - cd $GITHUB_WORKSPACE/killbill-client-java |
92 | | - mvn ${MAVEN_FLAGS} clean install -DskipTests=true |
93 | | - - name: Perform CodeQL Analysis |
94 | | - uses: github/codeql-action/analyze@v1 |
95 | | - with: |
96 | | - checkout_path: ${{ github.workspace }}/killbill-client-java |
| 10 | + uses: killbill/gh-actions-shared/.github/workflows/codeql-analysis.yml@main |
0 commit comments