Skip to content

Commit

Permalink
Migrated from Travis CI to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
VenomVendor committed Jun 11, 2024
1 parent f74156c commit 823aef8
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 67 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build on PR

on:
pull_request:
branches: [ "main" ]

jobs:
build:
name: Build on Java ${{ matrix.java }}
runs-on: ubuntu-latest
strategy:
matrix:
java: ["8", "11", "17", "21"]

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}

- name: Setup Gradle and publish build scans
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Set TERM variable for gradle
run: echo "TERM=dumb" >> $GITHUB_ENV

- name: Display environment info
run: |
./gradlew -v
uname -a
- name: Clean previous gradle builds
run: ./gradlew clean -q -S

- name: Build using gradle
run: ./gradlew build -q -S

- name: Remove Gradle cache lock file
if: always()
run: rm -rvf $HOME/.gradle/caches/modules-2/modules-2.lock

test:
needs: build
name: Test on Java 17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"

- name: Setup Gradle and publish build scans
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Set TERM variable for gradle
run: echo "TERM=dumb" >> $GITHUB_ENV

- name: Display environment info
run: |
./gradlew -v
uname -a
- name: Run tests with Gradle wrapper
run: ./gradlew test -i -S

- name: Remove Gradle cache lock file
if: always()
run: rm -rvf $HOME/.gradle/caches/modules-2/modules-2.lock

review:
needs: test
name: Code Review
runs-on: ubuntu-latest
steps:
- name: Code coverage reports by Codecov
uses: codecov/codecov-action@v4.0.1
with:
name: Branch Coverage
codecov_yml_path: .codecov.yml
token: ${{ secrets.CODECOV_TOKEN }}
slug: VenomVendor/NullDefense
file: ./build/reports/jacoco/report.xml
fail_ci_if_error: true
61 changes: 61 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish on Change

on:
push:
branches: [ $default-branch ]

jobs:
publish:
name: Publish artifacts
runs-on: ubuntu-latest
environment: publish

steps:
- uses: actions/checkout@v4
- name: Setup Java 21
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "temurin"
architecture: x64

- name: Setup Gradle and publish build scans
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Set TERM variable for gradle
run: echo 'TERM=dumb' >> $GITHUB_ENV

- name: Display environment info
run: |
./gradlew -v
uname -a
- name: Build using gradle
run: |
./gradlew build -q -S
./gradlew publish
- name: Remove Gradle cache lock file
if: always()
run: rm -rvf $HOME/.gradle/caches/modules-2/modules-2.lock

coverage:
name: Code Coverage
needs: publish
runs-on: ubuntu-latest
steps:
- name: Code coverage reports by Codecov
uses: codecov/codecov-action@v4.0.1
with:
name: Full Coverage
codecov_yml_path: .codecov.yml
token: ${{ secrets.CODECOV_TOKEN }}
slug: VenomVendor/NullDefense
file: ./build/reports/jacoco/report.xml
67 changes: 0 additions & 67 deletions .travis.yml

This file was deleted.

0 comments on commit 823aef8

Please sign in to comment.