bitwarden-android/.github/workflows/test.yml

96 lines
2.7 KiB
YAML
Raw Normal View History

2024-05-30 18:01:05 +03:00
name: Test
on:
2024-05-30 18:01:05 +03:00
push:
branches:
- "main"
- "rc"
- "hotfix-rc"
pull_request_target:
types: [opened, synchronize]
merge_group:
type: [checks_requested]
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JAVA_VERSION: 17
jobs:
2024-05-30 18:01:05 +03:00
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main
test:
name: Test
2024-09-30 19:51:05 +03:00
runs-on: ubuntu-24.04
2024-05-30 18:01:05 +03:00
needs: check-run
permissions:
contents: read
issues: write
2024-05-30 18:20:07 +03:00
packages: read
pull-requests: write
2024-05-30 18:01:05 +03:00
steps:
2024-05-30 18:01:05 +03:00
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
2024-05-30 18:01:05 +03:00
ref: ${{ github.event.pull_request.head.sha }}
2024-05-30 18:01:05 +03:00
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0
2024-02-05 21:28:09 +03:00
2024-05-30 18:01:05 +03:00
- name: Cache Gradle files
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
2024-02-05 21:28:09 +03:00
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
2024-03-15 21:37:34 +03:00
key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
2024-02-05 21:28:09 +03:00
restore-keys: |
${{ runner.os }}-gradle-v2-
2024-06-01 00:42:38 +03:00
- name: Cache build output
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
2024-06-01 00:42:38 +03:00
with:
path: |
${{ github.workspace }}/build-cache
key: ${{ runner.os }}-build-cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-
- name: Configure Ruby
uses: ruby/setup-ruby@7bae1d00b5db9166f4f0fc47985a3a5702cb58f0 # v1.197.0
with:
bundler-cache: true
- name: Configure JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
2024-05-30 18:01:05 +03:00
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}
- name: Install Fastlane
run: |
gem install bundler:2.2.27
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
2024-05-30 18:01:05 +03:00
- name: Build and test
run: |
bundle exec fastlane check
- name: Upload test reports on failure
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: failure()
with:
name: test-reports
path: app/build/reports/tests/
- name: Upload to codecov.io
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
2024-06-26 23:06:36 +03:00
file: app/build/reports/kover/reportStandardDebug.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}