Minor bug fix #35
Workflow file for this run
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
name: Validate | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
style_check: | ||
name: Style/Format check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout git repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Commit Linter | ||
uses: wagoid/commitlint-github-action@v2.0.3 | ||
build_test: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
envronment: prod # for access to codecov token | ||
steps: | ||
- name: Checkout git repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Extract commit info | ||
id: commit_info | ||
run: | | ||
short_sha="$(git rev-parse --short $GITHUB_SHA)" | ||
branch_name_pr="pr$(echo $GITHUB_REF | sed -e 's/refs\/pull\/\(.*\)\/merge/\1/')" | ||
branch_name_push="$(echo $GITHUB_REF | sed -E 's/refs\/heads\/([a-zA-Z0-9.-]+)/\1/')" | ||
branch_name="$(if [[ $GITHUB_EVENT_NAME == "pull_request" ]]; then echo $branch_name_pr; else echo $branch_name_push; fi)" | ||
echo "::set-output name=short_sha::$short_sha" | ||
echo "::set-output name=branch_name::$branch_name" | ||
- name: Generate version | ||
id: versioning | ||
uses: paulhatch/semantic-version@v4.0.1 | ||
with: | ||
major_pattern: "/^((fix)|(feat)|(perf))(\\([a-z]+\\))?!:/" | ||
minor_pattern: "/^((fix)|(feat)|(perf))(\\([a-z]+\\))?:/" | ||
format: "${major}.${minor}.${patch}-${{ steps.commit_info.outputs.branch_name }}.${increment}" | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '8' | ||
- name: Restore Gradle cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/*.properties', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Build and test | ||
run: ./gradlew build test compilerTest jacocoTestReport | ||
env: | ||
AUTO_GENERATED_VERSION: ${{ steps.versioning.outputs.version }} | ||
- name: Upload coverage report | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
- name: Cleanup Gradle cache | ||
# These files shouldn't be cached according to https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle | ||
run: | | ||
rm -f ~/.gradle/caches/modules-2/modules-2.lock | ||
rm -f ~/.gradle/caches/modules-2/gc.properties | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: fabrication-engine-${{ steps.versioning.outputs.version }} | ||
path: build/libs |