Add idea-ext plugin #70
This file contains hidden or 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: Build | |
on: | |
# Trigger the workflow on pushes to only the 'master' branch (this avoids duplicate checks being run e.g. for dependabot pull requests) | |
push: | |
branches: [ master ] | |
# Trigger the workflow on any pull request | |
pull_request: | |
concurrency: | |
group: build-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
gradleValidation: | |
name: Gradle Wrapper | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
- name: Gradle Wrapper Validation | |
uses: gradle/actions/wrapper-validation@v4 | |
zomboidInstallation: | |
name: Download Project Zomboid Server | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-latest | |
- ubuntu-latest | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
- name: Setup Project Zomboid cache | |
id: zomboid-install | |
uses: actions/cache@v4 | |
with: | |
path: ${{ runner.workspace }}/zomboid | |
key: pz-ubuntu-latest-${{ hashFiles('.github/current.pzversion') }} | |
lookup-only: 'true' | |
- name: Setup steamcmd | |
uses: CyberAndrii/setup-steamcmd@v1 | |
if: steps.zomboid-install.outputs.cache-hit != 'true' | |
- name: Install Project Zomboid | |
if: steps.zomboid-install.outputs.cache-hit != 'true' | |
run: | | |
steamcmd +force_install_dir "$ZOMBOID_PATH" \ | |
+login anonymous \ | |
+app_update 380870 \ | |
+quit | |
shell: bash | |
env: | |
ZOMBOID_PATH: ${{ runner.workspace }}/zomboid | |
codeInspection: | |
name: Code Inspection | |
needs: | |
- gradleValidation | |
- zomboidInstallation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
- name: Setup Project Zomboid cache | |
uses: actions/cache@v4 | |
id: zomboid-install | |
with: | |
path: ${{ runner.workspace }}/zomboid | |
key: pz-ubuntu-latest-${{ hashFiles('.github/current.pzversion') }} | |
- name: Setup steamcmd | |
uses: CyberAndrii/setup-steamcmd@v1 | |
if: steps.zomboid-install.outputs.cache-hit != 'true' | |
- name: Install Project Zomboid | |
if: steps.zomboid-install.outputs.cache-hit != 'true' | |
run: | | |
steamcmd +force_install_dir "$ZOMBOID_PATH" \ | |
+login anonymous \ | |
+app_update 380870 \ | |
+quit | |
shell: bash | |
env: | |
ZOMBOID_PATH: ${{ runner.workspace }}/zomboid | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 21 | |
- name: Override Gradle properties | |
run: | | |
sed -i.bak '/zomboidPath=/d' gradle.properties | |
echo "zomboidPath=zomboid" >> gradle.properties | |
- name: Qodana - Code Inspection | |
uses: JetBrains/qodana-action@v2024.1 | |
with: | |
args: --volume=${{ runner.workspace }}/zomboid:/data/project/zomboid | |
env: | |
GRADLE_OPTS: "-PzomboidPath=zomboid" | |
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_1707253383 }} | |
QODANA_ENDPOINT: 'https://qodana.cloud' | |
- name: Qodana - Show Results Files | |
run: | | |
ls "$SARIF_PATH" -la | |
ls "$SARIF_PATH/results" -la | |
env: | |
SARIF_PATH: ${{ runner.temp }}/qodana | |
- name: Qodana - Upload Report | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json | |
test: | |
name: Test | |
needs: | |
- gradleValidation | |
- zomboidInstallation | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-latest | |
- ubuntu-latest | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 21 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Setup Project Zomboid cache | |
id: zomboid-install | |
uses: actions/cache@v4 | |
with: | |
path: ${{ runner.workspace }}/zomboid | |
key: pz-ubuntu-latest-${{ hashFiles('.github/current.pzversion') }} | |
- name: Setup steamcmd | |
uses: CyberAndrii/setup-steamcmd@v1 | |
if: steps.zomboid-install.outputs.cache-hit != 'true' | |
- name: Install Project Zomboid | |
if: steps.zomboid-install.outputs.cache-hit != 'true' | |
run: | | |
steamcmd +force_install_dir "$ZOMBOID_PATH" \ | |
+login anonymous \ | |
+app_update 380870 \ | |
+quit | |
shell: bash | |
env: | |
ZOMBOID_PATH: ${{ runner.workspace }}/zomboid | |
- name: Run Linters and Test | |
run: ./gradlew check -PzomboidPath=${{ runner.workspace }}/zomboid | |
- name: Collect Test Results | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ runner.os }} | |
path: ${{ github.workspace }}/build/reports/tests | |
build: | |
name: Build | |
needs: test | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.properties.outputs.version }} | |
changelog: ${{ steps.properties.outputs.changelog }} | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Setup Java 11 environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 21 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
dependency-graph: generate-and-submit | |
- name: Setup Project Zomboid cache | |
id: zomboid-install | |
uses: actions/cache@v4 | |
with: | |
path: ${{ runner.workspace }}/zomboid | |
key: pz-ubuntu-latest-${{ hashFiles('.github/current.pzversion') }} | |
- name: Setup steamcmd | |
uses: CyberAndrii/setup-steamcmd@v1 | |
if: steps.zomboid-install.outputs.cache-hit != 'true' | |
- name: Install Project Zomboid | |
if: steps.zomboid-install.outputs.cache-hit != 'true' | |
run: | | |
steamcmd +force_install_dir "$ZOMBOID_PATH" \ | |
+login anonymous \ | |
+app_update 380870 \ | |
+quit | |
shell: bash | |
env: | |
ZOMBOID_PATH: ${{ runner.workspace }}/zomboid | |
# Set environment variables | |
- name: Export Properties | |
id: properties | |
shell: bash | |
run: | | |
PROPERTIES="$(./gradlew properties -PzomboidPath=${{ runner.workspace }}/zomboid --console=plain -q)" | |
NAME="$(echo "$PROPERTIES" | grep "^name:" | cut -f2- -d ' ')" | |
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" | |
CHANGELOG="$(./gradlew -PzomboidPath=${{ runner.workspace }}/zomboid getChangelog --unreleased --no-header --console=plain -q)" | |
CHANGELOG="${CHANGELOG//'%'/'%25'}" | |
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" | |
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" | |
echo "::set-output name=version::$VERSION" | |
echo "::set-output name=artifact::$ARTIFACT" | |
echo "::set-output name=changelog::$CHANGELOG" | |
- name: Build Distribution | |
run: ./gradlew build distZip -PzomboidPath=${{ runner.workspace }}/zomboid | |
- name: Upload distribution | |
uses: actions/upload-artifact@v4 | |
with: | |
name: distribution-zip | |
path: ${{ github.workspace }}/extender-framework/build/dist/pz-extender-${{ steps.properties.outputs.version }}.zip | |
# Prepare a draft release for GitHub Releases page for the manual verification | |
# If accepted and published, release workflow would be triggered | |
releaseDraft: | |
name: Release Draft | |
if: github.event_name != 'pull_request' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Remove old release drafts by using the curl request for the available releases with draft flag | |
- name: Remove Old Release Drafts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh api repos/{owner}/{repo}/releases \ | |
--jq '.[] | select(.draft == true) | .id' \ | |
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} | |
# Create new release draft - which is not publicly visible and requires manual acceptance | |
- name: Create Release Draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create v${{ needs.build.outputs.version }} \ | |
--draft \ | |
--title "v${{ needs.build.outputs.version }}" \ | |
--notes "$(cat << 'EOM' | |
${{ needs.build.outputs.changelog }} | |
EOM | |
)" | |
- name: Download prepared distribution | |
uses: actions/download-artifact@v4 | |
with: | |
name: distribution-zip | |
- name: Upload distribution to Release Draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload v${{ needs.build.outputs.version }} \ | |
pz-extender-${{ needs.build.outputs.version }}.zip |