CI/CD #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-24.04 | |
| services: | |
| nacos: | |
| image: nacos/nacos-server:v2.4.3-slim | |
| env: | |
| MODE: standalone | |
| ports: | |
| - 8848:8848 | |
| - 9848:9848 | |
| options: >- | |
| --health-cmd="curl -f http://localhost:8848/nacos/v1/console/health/readiness" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=15 | |
| --health-start-period=60s | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Build with Maven | |
| run: mvn clean package -DskipTests | |
| - name: Run unit tests | |
| run: mvn test -pl rpc-core,rpc-transport-netty | |
| - name: Run integration tests | |
| run: mvn test -pl rpc-consumer -am -Dtest=FullIntegrationTest | |
| env: | |
| RPC_REGISTRY: local | |
| - name: Check test coverage | |
| run: mvn jacoco:report | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: | | |
| **/target/surefire-reports/ | |
| **/target/site/jacoco/ | |
| code-quality: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Run Maven verify | |
| run: mvn verify -DskipTests | |
| - name: Check code style | |
| run: mvn checkstyle:check || true |