Update flipper to v0.214.0 (#920) #2465
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: CI | |
on: | |
# Only run push on main | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '*.md' | |
# Always run on PRs | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ci-${{ github.ref }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Gradle Wrapper Validation | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Install JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '20' | |
- uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-home-cache-cleanup: true | |
cache-read-only: false | |
- name: Prepare Gradle Home | |
run: | | |
mkdir -p ~/.gradle | |
touch ~/.gradle/gradle.properties | |
- name: Bootstrap | |
run: ./gradlew bootstrap --stacktrace | |
- name: Get changed files | |
if: always() && github.event_name == 'pull_request' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
mkdir tmp | |
gh pr view ${{ github.event.number }} --json files -q '.files[].path' > tmp/changed_files.txt | |
- name: Compute affected projects | |
if: always() && github.event_name == 'pull_request' | |
id: gradle-affected-projects | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: computeAffectedProjects --changed-files tmp/changed_files.txt -Pslack.debug=true --stacktrace | |
- name: Check affected projects | |
run: | | |
path="build/skippy/affected_projects.txt" | |
if [[ -e "$path" ]]; then | |
cat "$path" | |
# Copy focus file to root of project | |
# Necessary to omit the newline because the focus plugin reads the whole file text! | |
# TODO changing settings breaks caching https://issuetracker.google.com/issues/279997228 | |
# echo -n "build/skippy/focus.settings.gradle" > .focus | |
# Check if app is affected | |
if grep -q ":app" "$path"; then | |
echo "App is affected" | |
echo 'APP_TARGET=:app:assembleRelease' >> $GITHUB_ENV | |
else | |
echo "App is not affected" | |
echo 'APP_TARGET=' >> $GITHUB_ENV | |
fi | |
else | |
echo "No file found, all projects are affected" | |
echo 'APP_TARGET=:app:assembleRelease' >> $GITHUB_ENV | |
fi | |
- name: Upload skippy diagnostics | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reports | |
path: build/skippy/** | |
- name: Build and run tests | |
run: ./gradlew check ${{ env.APP_TARGET }} globalCiLint globalCiUnitTest --continue --quiet --stacktrace -Pslack.avoidance.affectedProjectsFile=build/skippy/affected_projects.txt | |
- name: Filter sarif | |
if: always() && github.event_name == 'pull_request' | |
run: | | |
./.github/workflows/sarif-filter.main.kts --sarif-file app/build/reports/lint-results-release.sarif --modified-files tmp/changed_files.txt --output-file tmp/modified_sarif.sarif | |
- name: Check if output sarif exists | |
id: check_file | |
run: | | |
if [[ -f tmp/modified_sarif.sarif ]]; then | |
echo "modified_sarif_exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "modified_sarif_exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Upload lint sarif | |
if: steps.check_file.outputs.modified_sarif_exists == 'true' | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: tmp/modified_sarif.sarif | |
- name: (Fail-only) Upload build reports | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reports | |
path: | | |
**/build/reports/* |