-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6178 from LitterSun/github_actions
Migrate CI checks from CircleCI to GitHub actions
- Loading branch information
Showing
2 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Check Java formatting | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
check_java_formatting: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK 11.0.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11.0.8 | ||
|
||
- name: Download google-java-format 1.9 | ||
run: | | ||
curl -L -o $HOME/google-java-format.jar https://github.com/google/google-java-format/releases/download/google-java-format-1.9/google-java-format-1.9-all-deps.jar | ||
curl -L -o $HOME/google-java-format-diff.py https://raw.githubusercontent.com/google/google-java-format/google-java-format-1.9/scripts/google-java-format-diff.py | ||
- name: Check Java formatting | ||
run: | | ||
diff=$(git diff -U0 $(git merge-base HEAD origin/master) | python $HOME/google-java-format-diff.py --google-java-format-jar=$HOME/google-java-format.jar -p1) | ||
if [[ $diff ]]; then | ||
echo "Please run google-java-format on the changes in this pull request" | ||
git diff -U0 $(git merge-base HEAD origin/master) | python $HOME/google-java-format-diff.py --google-java-format-jar=$HOME/google-java-format.jar -p1 | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle | ||
~/.m2 | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK 11.0.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11.0.8 | ||
|
||
- name: Build | ||
run: SKIP_JAVADOC=true ./gradlew clean assemble testClasses --parallel --stacktrace | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
api-versions: ['16,17,18', '19,21,22', '23,24,25', '26,27,28', '29,20'] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle | ||
~/.m2 | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set up JDK 11.0.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11.0.8 | ||
|
||
- name: Run tests | ||
run: | | ||
./gradlew test --info --stacktrace --continue \ | ||
--parallel \ | ||
-Drobolectric.enabledSdks=${{ matrix.api-versions }} \ | ||
-Drobolectric.alwaysIncludeVariantMarkersInTestName=true \ | ||
-Dorg.gradle.workers.max=2 | ||
- name: Upload Test Results | ||
uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: test_results_${{ matrix.api-versions }} | ||
path: '**/build/test-results/**/TEST-*.xml' | ||
|
||
publish_test_results: | ||
needs: tests | ||
if: always() | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download All Test Results | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: artifacts | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
working-directory: artifacts | ||
|
||
- name: Publish All Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v1.7 | ||
if: always() | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
files: 'artifacts/**/TEST-*.xml' |