Fix GitHub actions (#162) #459
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
# To run the e2e tests. | |
# currently setup on dev branch. | |
name: E2E | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'oracle' | |
cache: 'gradle' | |
- name: Setup Gradle 5.6.4 | |
uses: gradle/[email protected] | |
with: | |
gradle-version: 5.6.4 | |
- name: Execute Gradle build | |
run: ./gradlew clean build copyDependencies :server:copyJacocoAgent -x test | |
- name: Prepare mount directory for Web container - to write code coverage file. | |
run: chmod a+w server/build/jacoco | |
- name: Build the Varadhi Docker image | |
run: docker build . --file setup/docker/Dockerfile --tag varadhi.docker.registry/varadhi:latest --build-arg ENV=test | |
- name: Setup the environment | |
run: docker compose --profile test -f setup/docker/compose.yml up -d --wait --wait-timeout 180 | |
- name: Run the test | |
run: ./gradlew test testE2E | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action/composite@v2 | |
if: success() | |
with: | |
files: | | |
*/build/test-results/**/TEST*.xml | |
fail_on: 'test failures' | |
compare_to_earlier_commit: false | |
- name: Dump test execution logs | |
uses: jwalton/gh-docker-logs@v2 | |
with: | |
images: 'varadhi.docker.registry/varadhi,apachepulsar/pulsar,zookeeper' | |
- name: Restart the server process to force the code coverage dump | |
run: docker exec docker-web-1 pkill java | |
- name: Generate Code Coverage report | |
run: ./gradlew jacocoTestReport | |
- name: Publish code coverage (uses CodeCov.io) | |
uses: codecov/codecov-action@v3 | |
with: | |
files: | | |
*/build/reports/jacoco/test/jacocoTestReport.xml | |
- name: Tear down the docker containers | |
run: docker compose --profile test -f setup/docker/compose.yml down | |
- name: Tear down the data volumes | |
run: docker volume rm $(docker volume ls -q | egrep -E 'zk|pulsar') |