Add GitHub Actions CI: run gradle tests on PRs to master

Runs ./gradlew test (Temurin 25, Gradle cache, Testcontainers on the
runner's Docker) on every pull request to master and on push to master,
uploading build/reports/tests when tests fail. gradlew gets the
executable bit in git. The gitea deploy workflow is unchanged. README
describes the check and recommends making it required for master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SlimusMinus
2026-10-21 22:27:59 +03:00
parent f660e6828b
commit d6c88f9e57
3 changed files with 53 additions and 0 deletions

41
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: CI
on:
pull_request:
branches: [master]
push:
branches: [master]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: gradle test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 25
cache: gradle
# gradlew мог попасть в репозиторий с CRLF и без бита исполнения
- name: Prepare gradlew
run: sed -i 's/\r$//' gradlew && chmod +x gradlew
# Testcontainers поднимает PostgreSQL 15 в Docker раннера
- name: Test
run: ./gradlew test --no-daemon
- name: Upload test reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports
path: build/reports/tests
retention-days: 14