Add AGENTS.md with repo-specific guidance for future agents #3
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: Unit Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| name: Run Unit Tests | |
| runs-on: ubuntu-latest | |
| if: | | |
| !contains(github.event.head_commit.message, '[skip ci]') && | |
| github.actor != 'github-actions[bot]' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.head_ref || github.ref }} | |
| - name: Check if fork PR | |
| id: fork-check | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then | |
| echo "is_fork=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_fork=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Setup build environment | |
| uses: ./.github/actions/setup | |
| with: | |
| setup-android: 'true' | |
| - name: Verify Java version | |
| run: | | |
| echo "JAVA_HOME: $JAVA_HOME" | |
| java -version | |
| - name: Run spotlessCheck | |
| run: ./gradlew spotlessCheck --no-daemon --stacktrace | |
| - name: Run spotlessApply | |
| run: ./gradlew spotlessApply --no-daemon --stacktrace | |
| - name: Verify screenshots | |
| id: verify-screenshots | |
| continue-on-error: true | |
| run: ./gradlew :screenshotTests:verifyPaparazziDebug --no-daemon --stacktrace | |
| - name: Run updateScreenshots | |
| run: ./gradlew :screenshotTests:updateScreenshots --no-daemon --stacktrace | |
| - name: Run desktop tests | |
| run: ./gradlew :composeApp:desktopTest --no-daemon --stacktrace | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Fail if fork PR has changes | |
| if: | | |
| (steps.changes.outputs.has_changes == 'true' || steps.verify-screenshots.outcome == 'failure') && | |
| steps.fork-check.outputs.is_fork == 'true' | |
| run: | | |
| echo "::error::This PR from a fork requires formatting or screenshot updates." | |
| echo "Please run the following commands locally and push the changes:" | |
| echo " ./gradlew spotlessApply" | |
| echo " ./gradlew :screenshotTests:updateScreenshots" | |
| exit 1 | |
| - name: Commit and push changes | |
| if: | | |
| steps.changes.outputs.has_changes == 'true' && | |
| (github.event_name == 'push' || steps.fork-check.outputs.is_fork == 'false') | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add -A | |
| git commit -m "Auto-fix: spotlessApply and updateScreenshots [skip ci]" | |
| git push |