X-Trace-ID and structured logging output. #3891
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: Build And Test CWMS Data API | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| branches: | |
| - develop | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| jdk: [11] | |
| # place holder for now and leaving commented but in place. General scheme target tests again the current release, the next release, the previous release, and latest development. | |
| # at this time every possible instance of concern is on 25.07.01, once 26.02.17 is finalized it becomes release and 25.07.01 becomes previous. | |
| # next-release will be comment out until such time as a RC gets made | |
| schema: | |
| - env: latest | |
| image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:latest-dev" | |
| - env: release | |
| image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:25.07.01" | |
| - env: next-release | |
| image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:26.02.17-RC01" | |
| # - env: previous | |
| # image: "ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/database-ready-ora-23.5:25.07.01" | |
| name: build and test (jdk ${{matrix.jdk}}, schema ${{matrix.schema.env}}) | |
| runs-on: ubuntu-latest | |
| outputs: | |
| thewar: ${{steps.thebuild.outputs.WARFILE}} | |
| steps: | |
| - name: Clean up disk space, so we don't run out. | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| - name: checkout code | |
| uses: actions/checkout@v5.0.0 | |
| - name: setup java | |
| uses: actions/setup-java@v5.2.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{matrix.jdk}} | |
| cache: 'gradle' | |
| - name: build and test | |
| id: thebuild | |
| run: ./gradlew clean build --info --init-script init.gradle | |
| - name: integration tests | |
| run: ./gradlew integrationtest --info --init-script init.gradle -PCDA.oracle.database.image=${{matrix.schema.image}} | |
| - name: Create matrix job badge | |
| if: success() || failure() # always run even if the previous step fails | |
| uses: ./.github/actions/badge | |
| with: | |
| label: 'Build' | |
| status: ${{ job.status == 'success' && 'Pass' || 'Fail' }} | |
| file: ${{ matrix.jdk }}/${{ matrix.schema.env }}.svg | |
| run_id: ${{ github.run_id }} | |
| # - name: Publish Test Report | |
| # uses: mikepenz/action-junit-report@v5 | |
| # if: success() || failure() # always run even if the previous step fails | |
| # with: | |
| # annotate_only: true | |
| # include_passed: true | |
| # report_paths: '**/TEST-*.xml' | |
| open-api-static-analysis: | |
| name: OpenApi Static Analysis Tests | |
| runs-on: ubuntu-latest | |
| env: | |
| OPEN_API_TEST: "true" | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@v5.0.0 | |
| - name: setup java | |
| uses: actions/setup-java@v5.2.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 11 | |
| cache: 'gradle' | |
| - name: build and test | |
| id: thebuild | |
| run: ./gradlew clean :cwms-data-api:test --tests "cwms.cda.api.OpenApiDocTest" --info --init-script init.gradle | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v5 | |
| if: always() | |
| with: | |
| annotate_only: true | |
| include_passed: true | |
| report_paths: '**/TEST-*.xml' | |
| detailed_summary: true | |
| build-docker-image: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@v5.0.0 | |
| - name: Build docker image | |
| run: docker build -t cda:build-latest . | |
| build-schema-migration-image: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@v5.0.0 | |
| # No uploads, we're just verifying that nothing broke the docker image. | |
| - name: Build Migration image | |
| uses: ./.github/actions/database-migration-image | |
| with: | |
| base-image: ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/schema_installer | |
| # TODO get current target image from build information | |
| tag: latest-dev | |
| badges: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| # we are reporing build state so always run, but only on builds on the main branch | |
| if: always() && (github.ref_name == 'develop') | |
| steps: | |
| - name: Badge Branch | |
| uses: actions/checkout@v5.0.0 | |
| with: | |
| ref: badges | |
| fetch-depth: 1 | |
| - name: Download badges | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: badges_${{ github.run_id }}_* | |
| path: ./build # directory to download artifacts into | |
| merge-multiple: true # downloaded artifacts will be in the same directory specified by path | |
| - name: Apply Badge | |
| run: | | |
| find . -type f | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add build/**/*.svg | |
| git status | |
| git commit --allow-empty -m "Update Badge for build of ${{ github.sha }}" | |
| git push origin badges -f |