You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
2.0 KiB
94 lines
2.0 KiB
name: Backend CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop, feature/** ]
|
|
paths:
|
|
- 'pom.xml'
|
|
- 'ruoyi-*/**'
|
|
- 'book-system/**'
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
paths:
|
|
- 'pom.xml'
|
|
- 'ruoyi-*/**'
|
|
- 'book-system/**'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:8.0
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: root
|
|
MYSQL_DATABASE: ry-vue
|
|
ports:
|
|
- 3306:3306
|
|
options: >-
|
|
--health-cmd="mysqladmin ping"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
redis:
|
|
image: redis:7
|
|
ports:
|
|
- 6379:6379
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 11
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '11'
|
|
distribution: 'temurin'
|
|
cache: maven
|
|
|
|
- name: Cache Maven dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.m2/repository
|
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-maven-
|
|
|
|
- name: Build with Maven
|
|
run: mvn clean compile -DskipTests
|
|
|
|
- name: Run Checkstyle
|
|
run: mvn checkstyle:checkstyle
|
|
continue-on-error: true
|
|
|
|
- name: Run tests
|
|
run: mvn test
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-results
|
|
path: '**/surefire-reports/*.xml'
|
|
|
|
- name: Upload coverage reports
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
files: '**/jacoco.xml'
|
|
fail_ci_if_error: false
|
|
|
|
- name: Package application
|
|
run: mvn package -DskipTests
|
|
|
|
- name: Upload JAR
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ruoyi-admin
|
|
path: ruoyi-admin/target/*.jar
|