Merge pull request #1579 from rjhancock/oif-setup #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CodeQL" | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
schedule: | |
- cron: "24 16 * * 4" | |
jobs: | |
analyze: | |
name: Analyze | |
runs-on: ${{ matrix.os }} | |
outputs: | |
mmRepo: ${{ steps.find_mm.outputs.mmRepo }} | |
mmBranch: ${{ steps.find_mm.outputs.mmBranch }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
language: ["java"] | |
java-distribution: [temurin] | |
java-version: [17] | |
fail-fast: false | |
steps: | |
- name: Checkout MegaMekLab | |
uses: actions/checkout@v4 | |
with: | |
path: megameklab | |
- name: Find the Right MegaMek Branch | |
id: find_mm | |
shell: bash {0} | |
run: | | |
git ls-remote --exit-code --heads ${{ github.event.pull_request.head.repo.owner.html_url }}/megamek.git ${{ github.event.pull_request.head.ref }} | |
if [ "$?" == "0" ] | |
then | |
echo "mmRepo=${{ github.event.pull_request.head.repo.owner.login }}/megamek" >> $GITHUB_OUTPUT | |
echo "mmBranch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT | |
else | |
echo "mmRepo=MegaMek/megamek" >> $GITHUB_OUTPUT | |
echo "mmBranch=master" >> $GITHUB_OUTPUT | |
fi | |
exit 0 | |
- name: Checkout MegaMek | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ steps.find_mm.outputs.mmRepo }} | |
ref: ${{ steps.find_mm.outputs.mmBranch }} | |
path: megamek | |
- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ matrix.java-distribution }} | |
java-version: ${{ matrix.java-version }} | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
queries: +security-and-quality | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build with Gradle | |
working-directory: megameklab | |
run: ./gradlew jar | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 |