diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0162b8c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,132 @@ +name: CI Pipeline + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4.2.2 + with: + sparse-checkout: | + maven-spring + + - name: Set up JDK 21 (Temurin) + uses: actions/setup-java@v4.7.0 + with: + java-version: '21' + distribution: 'temurin' + + - name: Cache Maven packages + uses: actions/cache@v4.2.3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: Compile code + run: mvn compile -f maven-spring/pom.xml + + format: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4.2.2 + with: + sparse-checkout: | + maven-spring + + - name: Set up JDK 21 (Temurin) + uses: actions/setup-java@v4.7.0 + with: + java-version: '21' + distribution: 'temurin' + + - name: Cache Maven packages + uses: actions/cache@v4.2.3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: Check code formatting + run: mvn spotless:check -f maven-spring/pom.xml + + test: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4.2.2 + with: + sparse-checkout: | + maven-spring + + - name: Set up JDK 21 (Temurin) + uses: actions/setup-java@v4.7.0 + with: + java-version: '21' + distribution: 'temurin' + + - name: Cache Maven packages + uses: actions/cache@v4.2.3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: Rclearun tests + run: mvn test -f maven-spring/pom.xml + + codeql: + runs-on: ubuntu-latest + needs: build + permissions: + security-events: write + + steps: + - name: Checkout code + uses: actions/checkout@v4.2.2 + with: + sparse-checkout: | + maven-spring + + - name: Set up JDK 21 (Temurin) + uses: actions/setup-java@v4.7.0 + with: + java-version: '21' + distribution: 'temurin' + + - name: Cache Maven packages + uses: actions/cache@v4.2.3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2.21.0 + with: + languages: java + source-root: maven-spring + + - name: Autobuild + uses: github/codeql-action/autobuild@v2.21.0 + with: + working-directory: maven-spring + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2.21.0 + with: + output: maven-spring/results diff --git a/maven-spring/.github/workflows/ci.yml b/maven-spring/.github/workflows/ci.yml deleted file mode 100644 index 37329fd..0000000 --- a/maven-spring/.github/workflows/ci.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: CI Pipeline - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up JDK 21 (Temurin) - uses: actions/setup-java@v3 - with: - java-version: '21' - distribution: 'temurin' - - - name: Cache Maven packages - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-maven- - - - name: Format code with Spotless - run: mvn spotless:apply - - - name: Compile code - run: mvn compile - - - name: Run tests - run: mvn test - - codeql: - runs-on: ubuntu-latest - needs: build - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: java-kotlin - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2