Skip to content

Commit

Permalink
Setup Github "cache" action (#599)
Browse files Browse the repository at this point in the history
* Enable caching of local maven repo + maven wrapper
* Bump Github actions to latest version
* Use "adopt" JDK instead of "Zulu"
* Speedup Maven execution by limiting the compiler at tier 1 (java proceess won't last long enough to benefit from more aggressive optimisations)
  • Loading branch information
brenuart committed Aug 5, 2021
1 parent 0e34f3d commit e983390
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,67 @@ on:
- push
- pull_request

env:
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"

jobs:
build:
name: build
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '16' ]
steps:
- uses: actions/checkout@v1.1.0
- name: setup JDK
uses: actions/setup-java@v1
- uses: actions/checkout@v2
- name: Setup JAVA
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: ${{ matrix.java }}
- name: build
- uses: actions/cache@v2.1.6
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml verify

release:
name: release
if: github.event_name == 'push' && github.repository == 'logstash/logstash-logback-encoder' && github.ref == 'refs/heads/main' && startsWith(github.event.commits[0].message, '[release]')
runs-on: ubuntu-20.04
needs: [build]
steps:
- uses: actions/checkout@v1.1.0
- uses: actions/checkout@v2
with:
ref: main
- uses: actions/setup-java@v1
- name: Setup JAVA
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: 1.8
- name: setup-gpg
- name: Setup GPG
run: .github/workflows/steps/setup-gpg.sh
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: setup-git
- name: Setup GIT
run: |
.github/workflows/steps/setup-git.sh
git switch main
- name: release
- uses: actions/cache@v2.1.6
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Release
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml --activate-profiles ossrh release:prepare release:perform
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
Expand Down

0 comments on commit e983390

Please sign in to comment.