Skip to content

Flutter P5b: flutter_app_status, logcat errors, rebuild window, cross-layer problems (#153) #457

Flutter P5b: flutter_app_status, logcat errors, rebuild window, cross-layer problems (#153)

Flutter P5b: flutter_app_status, logcat errors, rebuild window, cross-layer problems (#153) #457

Workflow file for this run

name: Build
on:
push:
branches: [master]
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
artifact: ${{ steps.artifact.outputs.filename }}
steps:
- name: Fetch Sources
uses: actions/checkout@v4
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
cache: gradle
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "name=$NAME" >> $GITHUB_OUTPUT
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Run Unit Tests
run: ./gradlew test
- name: Run Static Analysis
run: ./gradlew detekt
- name: Upload Reports
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: reports
path: |
./build/reports/tests
./build/reports/detekt
if-no-files-found: ignore
- name: Build Plugin
run: ./gradlew buildPlugin
# Catch a descriptor that would be unpublishable or invisible on the Marketplace at
# pull-request time, not at release time.
- name: Verify Marketplace Descriptor
run: scripts/verify-marketplace-descriptor.sh
- name: Prepare Plugin Artifact
id: artifact
shell: bash
run: |
cd ${{ github.workspace }}/build/distributions
FILENAME=$(ls *.zip | head -1)
unzip "$FILENAME" -d content
echo "filename=${FILENAME%.zip}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*
verify:
name: Plugin Verifier
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
cache: gradle
- name: Free Disk Space
run: |
# The verifier downloads one full IDE per target; the default runner image
# does not leave enough room for five of them.
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
df -h /
- name: Cache Verifier IDEs
uses: actions/cache@v4
with:
path: ~/.pluginVerifier
key: plugin-verifier-${{ hashFiles('build.gradle.kts') }}
restore-keys: plugin-verifier-
- name: Run Plugin Verifier
run: ./gradlew verifyPlugin
- name: Upload Verifier Report
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: plugin-verifier-report
path: ./build/reports/pluginVerifier
if-no-files-found: ignore
releaseDraft:
name: Release Draft
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Fetch Sources
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
cache: gradle
- name: Build Plugin (for zip attachment)
run: ./gradlew buildPlugin
- 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/{}
- name: Create Release Draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Passed as an environment variable, never interpolated into the script body.
# `${{ }}` substitution happens before the shell parses the script, so changelog
# markdown was being executed: backticks became command substitution
# ("BaseAction: command not found"), and `!!` and `$(...)` broke the parse.
RELEASE_NOTES: ${{ needs.build.outputs.changelog }}
run: |
TAG="v${{ needs.build.outputs.version }}"
# This job runs on every push to master, but the release it creates is named after
# pluginVersion. If that version has already been published, `gh release create`
# fails on the existing tag and takes the whole master build red — which is exactly
# what happened when pluginVersion was left at 3.0.0 after v3.0.1 shipped.
# A published release is a signal to bump the version, not a build failure.
if gh release view "$TAG" --json isDraft --jq .isDraft 2>/dev/null | grep -q false; then
echo "::warning::Release $TAG is already published — skipping draft creation."
echo "Bump pluginVersion in gradle.properties to draft the next release."
exit 0
fi
printf '%s' "$RELEASE_NOTES" > "$RUNNER_TEMP/release-notes.md"
gh release create "$TAG" \
./build/distributions/*.zip \
--draft \
--title "$TAG" \
--notes-file "$RUNNER_TEMP/release-notes.md"