Skip to content

90 add setup guide #110

90 add setup guide

90 add setup guide #110

Workflow file for this run

# Workflow requires Variables to be defined as follows:
# secrets.PUSH_TOKEN -> Password with rights to push to repository
name: "Tests"
on:
workflow_dispatch:
pull_request:
branches:
- 'main'
jobs:
lint-commits:
name: Commitlint
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
persist-credentials: false
fetch-depth: 0
- name: Lint Commits
uses: wagoid/commitlint-github-action@v5
prettier:
name: Beautify
runs-on: ubuntu-latest
needs:
- lint-commits
outputs:
new_sha: ${{ steps.sha.outputs.SHA }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.PUSH_TOKEN }}
- name: Setup NPM
uses: actions/setup-node@v4
with:
node-version: 21
- name: Install Prettier
run: npm ci
- name: Run Prettier
run: npx prettier --write ./**/*.{java,md}
- name: Publish Changes
id: commit-and-push
uses: EndBug/[email protected]
with:
committer_name: "Prettier Action"
committer_email: "[email protected]"
message: "refactor(style): beautify ${{ github.head_ref }}"
push: true
- name: Update SHA
id: sha
run: |
if [[ "${steps.commit-and-push.outputs.pushed" == "true" ]]; then
new_sha="${{ steps.commit-and-push.outputs.commit_long_sha }}"
else
new_sha="${{ github.head_ref }}"
fi
echo "SHA=$new_sha" >> $GITHUB_OUTPUT
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
needs:
- prettier
steps:
- name: Output Commit Ref
run: |
echo "Checking out: ${{ needs.prettier.outputs.new_sha }}"
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ needs.prettier.outputs.new_sha }}
- name: Setup Java environment
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Clean Build Artifacts
run: ./gradlew clean
- name: Run All Integration Tests
run: ./gradlew test
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs:
- prettier
- unit-tests
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ needs.prettier.outputs.new_sha }}
- name: Setup Java Environment
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Clean Build Artifacts
run: ./gradlew clean
- name: Run Integration Tests
run: ./gradlew integrationTest