Skip to content

Commit

Permalink
Refactor of the Project on Github.
Browse files Browse the repository at this point in the history
-Added: Better System to decide what code should be generated.
-Added: Unit Tests are now included in the main branch.
-Added: Automatic System to test the main branch and ensure that tests work.
-Added: Pull Requests now run tests too.
  • Loading branch information
Speiger committed Jun 14, 2022
1 parent ddc58ee commit fb7c417
Show file tree
Hide file tree
Showing 186 changed files with 19,991 additions and 77 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Latest Build

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

jobs:
build:
strategy:
fail-fast: false
matrix:
jdk: [8, 11, 14, 16, 17]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

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

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew build
84 changes: 84 additions & 0 deletions .github/workflows/build_tests_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Unit Tests

on:
push:
branches: [ master ]

jobs:
build:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
cache: gradle

- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build and Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew generateTestSource test jacocoTestReport --info -Dfull_test_suite=true

- name: Publish Test Result
uses: EnricoMi/publish-unit-test-result-action@v1
id: test-results
if: always()
with:
files: build/test-results/**/*.xml
fail_on: nothing
ignore_runs: true
json_thousands_separator: .
time_unit: milliseconds

- name: Create Badge Color
shell: bash
run: |
case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in
success)
echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
;;
failure)
echo "BADGE_COLOR=800000" >> $GITHUB_ENV
;;
neutral)
echo "BADGE_COLOR=696969" >> $GITHUB_ENV
;;
esac
- name: Create Test Badge
uses: emibcn/[email protected]
with:
label: Tests
status: '${{ fromJSON( steps.test-results.outputs.json ).conclusion }}, Passed: ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests_succ }}, Skipped: ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests_skip }}, Failed: ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests_fail }}'
color: ${{ env.BADGE_COLOR }}
path: tests.svg

- name: Create Coverage Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
badges-directory: null
intervals: 95 80 70 60 50 0

- name: Upload Test Badge
uses: exuanbo/actions-deploy-gist@v1
with:
token: ${{ secrets.GIST_TOKEN }}
gist_id: 280257cd19cbe1dda3789bebd4ff65cf
file_path: tests.svg

- name: Upload Coverage Badge
uses: exuanbo/actions-deploy-gist@v1
with:
token: ${{ secrets.GIST_TOKEN }}
gist_id: 280257cd19cbe1dda3789bebd4ff65cf
file_path: jacoco.svg
36 changes: 0 additions & 36 deletions .github/workflows/build_validator.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/pull_build_tests_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Unit Tests

on:
pull_request:
branches: [ master ]

jobs:
build:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
cache: gradle

- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build and Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew generateTestSource test jacocoTestReport --info -Dfull_test_suite=true

- name: Publish Test Result
uses: EnricoMi/publish-unit-test-result-action@v1
id: test-results
if: always()
with:
files: build/test-results/**/*.xml
fail_on: nothing
ignore_runs: true
json_thousands_separator: .
time_unit: milliseconds
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,19 @@ gradle-app.setting
/src/main/java/speiger/src/collections/doubles/*
/src/main/java/speiger/src/collections/objects/*

#Generated Tests
/src/test/java/speiger/src/testers/booleans/*
/src/test/java/speiger/src/testers/bytes/*
/src/test/java/speiger/src/testers/shorts/*
/src/test/java/speiger/src/testers/chars/*
/src/test/java/speiger/src/testers/ints/*
/src/test/java/speiger/src/testers/longs/*
/src/test/java/speiger/src/testers/floats/*
/src/test/java/speiger/src/testers/doubles/*
/src/test/java/speiger/src/testers/objects/*
/src/test/java/speiger/src/tests/*

#Cache result
/src/builder/resources/speiger/assets/collections/cache.bin
/src/builder/resources/speiger/assets/testers/cache.bin
/src/builder/resources/speiger/assets/tests/cache.bin
Loading

0 comments on commit fb7c417

Please sign in to comment.