ci pipeline implementation #2
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 Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Checkout code | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # 2. Get Java version from pom.xml | |
| - name: Get Java version | |
| run: | | |
| JAVA_VERSION=$(mvn help:evaluate -Dexpression=maven.compiler.release -q -DforceStdout) | |
| echo "JAVA_VERSION=$JAVA_VERSION" >> $GITHUB_ENV | |
| # 3. Setup Java | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: temurin | |
| cache: maven | |
| # 4. Build project | |
| - name: Build | |
| run: mvn clean install | |
| # 5. Run tests | |
| - name: Test | |
| run: mvn test | |