Skip to content

Commit

Permalink
Setup skeleton for Gradle builds
Browse files Browse the repository at this point in the history
* Add CLI build step
* Setup UI unit tests
* Add Codecov support
  • Loading branch information
vadeg committed Jun 17, 2021
1 parent 277e665 commit 0820487
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 3 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/build-zally.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Zally Pull Request Builds

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build-zally:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Zally Server
run: |
cd server/
chmod +x gradlew
./gradlew --console=plain build
- uses: codecov/codecov-action@v1
with:
files: ./server/zally-server/build/reports/jacoco/test/jacocoTestReport.xml,./server/zally-ruleset-zally/build//reports/jacoco/test/jacocoTestReport.xml,./server/zally-ruleset-zalando/build/reports/jacoco/test/jacocoTestReport.xml,./server/zally-core/build/reports/jacoco/test/jacocoTestReport.xml,./server/zally-rule-api/build/reports/jacoco/test/jacocoTestReport.xml
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
build-github-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Github Integration
run: |
cd github-integration/
chmod +x gradlew
./gradlew --console=plain build
- uses: codecov/codecov-action@v1
with:
files: ./github-integration/build/reports/jacoco/test/jacocoTestReport.xml
- name: Cleanup Gradle Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
build-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- uses: actions/setup-go@v2
with:
go-version: '1.12'
- run: go version
- name: Run Zally server
run: |
cd server/
chmod +x gradlew
./gradlew --console=plain bootRun > /dev/null &
echo $! > /tmp/zally_server.pid
cd ..
while ! echo "GET / HTTP/1.0\n" | nc localhost 8000; do sleep 1; done
- name: Build & Run CLI tests
run: |
cd cli/zally
./test.sh
./test.sh integration
go build
cd ../..
- uses: codecov/codecov-action@v1
with:
files: ./cli/zally/coverage.txt

test-web-ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '10'
- name: Configure yarn
run: yarn install -q
- name: Build & Test CLI
run: |
cd web-ui
yarn add zally-web-ui
yarn test
yarn build
- uses: codecov/codecov-action@v1
with:
files: ./web-ui/target/coverage/lcov.info

7 changes: 4 additions & 3 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,14 @@ subprojects {
toolVersion = "0.8.2"
}

tasks.check {
dependsOn(tasks.jacocoTestReport)
tasks.test {
finalizedBy(tasks.jacocoTestReport)
}

tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.isEnabled = true
xml.required.set(true)
}
}

Expand Down

0 comments on commit 0820487

Please sign in to comment.