Build project #78
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: Build project | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- main | |
- trunk | |
- develop | |
- maine | |
- mane | |
schedule: | |
- cron: '0 3 * * 1,4' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 20 | |
- uses: gradle/gradle-build-action@v2 | |
- uses: gradle/wrapper-validation-action@v1 | |
- run: ./gradlew projectCodestyle | |
- run: ./gradlew assembleRelease check --scan | |
- run: ./gradlew projectCoverage | |
- run: ./gradlew publishToMavenLocal | |
- run: git diff --exit-code | |
- uses: actions/upload-artifact@v3 | |
if: ${{ always() }} | |
with: | |
name: lint-results | |
path: '${{ github.workspace }}/**/build/**/reports/lint-results-*.html' | |
- name: Unwrap GPG key | |
if: github.repository == 'usefulness/lazythreetenbp' && github.event_name != 'pull_request' | |
env: | |
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | |
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'" | |
- name: Publish | |
if: github.repository == 'usefulness/lazythreetenbp' && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | |
run: ./gradlew publishReleasePublicationToGithubRepository | true | |
- uses: actions/cache@v3 | |
if: github.event_name != 'pull_request' | |
name: Upload base (release) | |
with: | |
path: diffuse-source-file-release | |
key: diffuse-${{ github.sha }}-${{ hashFiles('**/aar/**.aar') }} | |
- run: cp lazythreetenbp/build/outputs/aar/lazythreetenbp-release.aar diffuse-source-file-release | |
if: github.event_name != 'pull_request' | |
shell: bash | |
ui-test: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
apiVersion: [ 23, 28, 30, 31, 33 ] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 20 | |
- uses: gradle/gradle-build-action@v2 | |
- name: run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.apiVersion }} | |
profile: pixel_xl | |
target: google_apis | |
arch: x86_64 | |
disable-spellchecker: true | |
script: ./gradlew connectedCheck | |
- name: Upload tests result | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "test-results [${{ matrix.apiVersion }}]" | |
path: "${{ github.workspace }}/**/reports/**" |