ci: split jobs
This commit is contained in:
66
.github/workflows/tests.yml
vendored
66
.github/workflows/tests.yml
vendored
@@ -7,8 +7,10 @@ on:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
cache-key: ${{ steps.cache-key-generator.outputs.key }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -20,26 +22,82 @@ jobs:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Generate cache key
|
||||
id: cache-key-generator
|
||||
run: echo "key=gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Gradle dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
key: ${{ steps.cache-key-generator.outputs.key }}
|
||||
restore-keys: |
|
||||
gradle-${{ runner.os }}-
|
||||
|
||||
- name: Grant execute permission to Gradle wrapper
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Lint
|
||||
lint:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Restore Gradle cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ needs.build.outputs.cache-key }}
|
||||
restore-keys: |
|
||||
gradle-${{ runner.os }}-
|
||||
|
||||
- name: Grant execute permission to Gradle wrapper
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Run lint
|
||||
run: ./gradlew ktlintCheck
|
||||
|
||||
test:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Restore Gradle cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ needs.build.outputs.cache-key }}
|
||||
restore-keys: |
|
||||
gradle-${{ runner.os }}-
|
||||
|
||||
- name: Grant execute permission to Gradle wrapper
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Start CI Docker Compose services
|
||||
run: ./gradlew composeUp -Pci
|
||||
|
||||
- name: Test
|
||||
- name: Run tests
|
||||
run: ./gradlew test -x composeUp --no-daemon
|
||||
|
||||
- name: Upload test reports
|
||||
|
||||
Reference in New Issue
Block a user