Skip to content

Commit

Permalink
Introduce GitHub Actions based CI workflow
Browse files Browse the repository at this point in the history
This PR introduces a CI workflow using GitHub Actions and removes the Travis CI configuration file.

Find new workflow runs for this PR here: https://github.com/sormuras/google-java-format/actions

#### TODO

- [x] Email [Notifications](https://docs.github.com/en/free-pro-team@latest/github/managing-subscriptions-and-notifications-on-github/configuring-notifications) -- register `[email protected]` as a watcher or let each interested use register themself?
- [ ] Test publish snapshot job on `google:master` -- after storing credential [secrets](https://github.com/google/google-java-format/settings/secrets/actions).
- [ ] Remove AppVeyor [integration](https://github.com/google/google-java-format/settings/installations) and delete `appveyor.yml` configuration file.

Closes #543

Fixes #544

COPYBARA_INTEGRATE_REVIEW=#544 from sormuras:github-action a689f62
PiperOrigin-RevId: 344280060
  • Loading branch information
sormuras authored and google-java-format Team committed Nov 25, 2020
1 parent 3ce0935 commit c1dd08d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 42 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on: [ push, pull_request ]

jobs:
test:
name: "JDK ${{ matrix.java }} on ${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
java: [ 15, 11 ]
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v2
- name: 'Cache local Maven repository'
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: 'Set up JDK ${{ matrix.java }}'
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: 'Install'
shell: bash
run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
- name: 'Test'
shell: bash
run: mvn test -B

publish_snapshot:
name: 'Publish snapshot'
needs: test
if: github.event_name == 'push' && github.repository == 'google/google-java-format' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v2
- name: 'Cache local Maven repository'
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: 'Set up JDK 15'
uses: actions/setup-java@v1
with:
java-version: 15
server-id: sonatype-nexus-snapshots
server-username: CI_DEPLOY_USERNAME
server-password: CI_DEPLOY_PASSWORD
- name: 'Publish'
run: mvn source:jar deploy -B -DskipTests=true -Dinvoker.skip=true -Dmaven.javadoc.skip=true
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

0 comments on commit c1dd08d

Please sign in to comment.