Files
event-demo/.github/workflows/tests.yml

105 lines
2.6 KiB
YAML

name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build (without tests & lint)
run: ./gradlew build --scan -x test -x ktlintKotlinScriptCheck -x ktlintTestSourceSetCheck -x ktlintMainSourceSetCheck | tee build.log
- name: Show Build Scan URL
run: grep -Eo 'https://scans.gradle.com/s/[a-zA-Z0-9]+' build.log
- name: processResources
run: ./gradlew processResources --scan | tee resources.log
- name: Show Resource Scan URL
run: grep -Eo 'https://scans.gradle.com/s/[a-zA-Z0-9]+' resources.log
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: build/
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: build/
- name: Compose Up
run: ./gradlew composeUp --scan | tee compose.log
- name: Show Compose Scan URL
run: grep -Eo 'https://scans.gradle.com/s/[a-zA-Z0-9]+' compose.log
- name: Run tests
run: ./gradlew test --scan | tee test.log
- name: Show Test Scan URL
run: grep -Eo 'https://scans.gradle.com/s/[a-zA-Z0-9]+' test.log
lint:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: build/
- name: Run linter
run: ./gradlew ktlintCheck --scan | tee lint.log
- name: Show Lint Scan URL
run: grep -Eo 'https://scans.gradle.com/s/[a-zA-Z0-9]+' lint.log