Implementing GitHub action work flow #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: Ecommerce Microservices CI with Maven | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| name: Build All Modules (skip tests) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build all modules (skipping tests) | |
| run: mvn --batch-mode clean install -DskipTests | |
| outputs: | |
| build-status-key: ${{ steps.cache.outputs.cache-hit }} | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Run tests | |
| run: mvn --batch-mode test | |
| # pull_request: | |
| # branches: | |
| # - master | |
| #jobs: | |
| # build-and-test: | |
| # runs-on: ubuntu-latest | |
| # | |
| # strategy: | |
| # matrix: | |
| # service: [product-service, | |
| # order-service, | |
| # inventory-service, | |
| # api-gateway, | |
| # config-server, | |
| # eureka-server] | |
| # steps: | |
| # - name: Check out the repository | |
| # uses: actions/checkout@v4 | |
| # - name: Set up JDK 17 | |
| # uses: actions/setup-java@v3 | |
| # with: | |
| # java-version: '17' | |
| # distribution: 'temurin' | |
| # cache: maven | |
| # | |
| # | |
| # - name: Build and test ${matrix.service} | |
| # working-directory: ./${{ matrix.service }} | |
| # run: mvn --batch-mode package |