-
Notifications
You must be signed in to change notification settings - Fork 3
NIAD-3192: Move from Jenkins to GitHub Actions #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
82fa5fd
d272fc4
8e5ecb0
c085d74
de28d30
9b04a79
41bd444
f82938e
09ea4bc
17b3107
695e0e8
4bf43e1
1cca8ec
43a2f5e
a2093f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| name: "Build" | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| branches: | ||
| - develop | ||
| push: | ||
| branches: | ||
| - develop | ||
|
|
||
| jobs: | ||
| tests: | ||
| name: NHAIS Adaptor Tests | ||
| uses: ./.github/workflows/test.yml | ||
| with: | ||
| path: . | ||
| secrets: inherit | ||
| # | ||
| # translator-tests: | ||
| # name: "GP2GP Translator Tests" | ||
| # uses: ./.github/workflows/test.yml | ||
| # with: | ||
| # name: GP2GP Translator | ||
| # path: ./gp2gp-translator | ||
| # secrets: inherit | ||
| # | ||
| # generate-build-id: | ||
| # name: "Generate Build Id" | ||
| # needs: [ common-modules-tests, facade-tests, translator-tests ] | ||
| # runs-on: ubuntu-latest | ||
| # outputs: | ||
| # build-id: ${{ steps.generate.outputs.buildId }} | ||
| # steps: | ||
| # - name: Checkout Repository | ||
| # uses: actions/checkout@v4 | ||
| # | ||
| # - id: generate | ||
| # working-directory: ./scripts | ||
| # shell: bash | ||
| # env: | ||
| # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| # run: | | ||
| # chmod +x ./create_build_id.sh | ||
| # | ||
| # if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
| # GIT_BRANCH=PR | ||
| # elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
| # GIT_BRANCH=main | ||
| # fi | ||
| # | ||
| # BUILD_ID=$(./create_build_id.sh $GIT_BRANCH ${{ github.run_number }} ${{ github.sha }}) | ||
| # echo "Generated the build tag: $BUILD_ID" | ||
| # echo "buildId=$BUILD_ID" >> "$GITHUB_OUTPUT" | ||
| # | ||
| # publish-docker-images: | ||
| # name: "Publish docker images to ECR" | ||
| # needs: [ generate-build-id ] | ||
| # strategy: | ||
| # matrix: | ||
| # config: | ||
| # - directory: gpc-facade | ||
| # repository: pss_gpc_facade | ||
| # build-context: . | ||
| # - directory: gp2gp-translator | ||
| # repository: pss_gp2gp-translator | ||
| # build-context: . | ||
| # - directory: snomed-schema | ||
| # repository: pss_snomed_schema | ||
| # build-context: . | ||
| # - directory: db-migration | ||
| # repository: pss_db_migration | ||
| # build-context: . | ||
| # - directory: mhs-adaptor-mock | ||
| # repository: pss-mock-mhs | ||
| # build-context: ./docker/mhs-adaptor-mock | ||
| # uses: ./.github/workflows/publish.yml | ||
| # with: | ||
| # directory: ${{ matrix.config.directory }} | ||
| # repository: ${{ matrix.config.repository }} | ||
| # build-context: ${{ matrix.config.build-context }} | ||
| # build-id: ${{ needs.generate-build-id.outputs.build-id }} | ||
| # secrets: inherit | ||
| # | ||
| # comment: | ||
| # if: github.event_name == 'pull_request' | ||
| # name: "Create Build ID Comment" | ||
| # needs: [ generate-build-id, publish-docker-images] | ||
| # continue-on-error: true | ||
| # permissions: write-all | ||
| # runs-on: [ ubuntu-latest ] | ||
| # steps: | ||
| # - name: Check out code | ||
| # uses: actions/checkout@v4 | ||
| # - name: Comment PR | ||
| # uses: thollander/actions-comment-pull-request@v3 | ||
| # with: | ||
| # message: | | ||
| # Images built and published to ECR using a Build Id of ${{ needs.generate-build-id.outputs.build-id }} | ||
| # comment_tag: images-built | ||
| # mode: upsert | ||
| # |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| name: Test Workflow | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| path: | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| unit-tests: | ||
| name: Unit Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Java 11 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 11 | ||
| distribution: temurin | ||
|
|
||
| - name: Execute Unit Tests | ||
| run: ./gradlew test --parallel --build-cache | ||
| working-directory: ${{ inputs.path }} | ||
|
|
||
| - name: Collect Artifacts | ||
| if: always() | ||
| run: | | ||
| mkdir -p artifacts | ||
| cp -r ./${{ inputs.path }}/build/reports ./artifacts | ||
|
|
||
| - name: Upload Artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: Unit Test Report | ||
| path: ./artifacts/** | ||
| compression-level: 9 | ||
|
|
||
| - name: Test Job Summary | ||
| if: always() | ||
| uses: test-summary/action@v2 | ||
| with: | ||
| paths: "${{ inputs.path }}/build/test-results/test/TEST-*.xml" | ||
|
|
||
| - name: Temporary Artifacts Cleanup | ||
| run: rm -rf ./artifacts | ||
|
|
||
| component-tests: | ||
| name: Component Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Java 11 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 11 | ||
| distribution: temurin | ||
|
|
||
| - name: Execute Component Tests | ||
| run: ./gradlew componentTest --build-cache | ||
| working-directory: ${{ inputs.path }} | ||
|
|
||
| - name: Collect Artifacts | ||
| if: always() | ||
| run: | | ||
| mkdir -p artifacts | ||
| cp -r ./${{ inputs.path }}/build/reports ./artifacts | ||
|
|
||
| - name: Upload Artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: Component Test Report | ||
| path: ./artifacts/** | ||
| compression-level: 9 | ||
|
|
||
| - name: Test Job Summary | ||
| if: always() | ||
| uses: test-summary/action@v2 | ||
| with: | ||
| paths: "${{ inputs.path }}/build/test-results/componentTest/TEST-*.xml" | ||
|
|
||
| - name: Temporary Artifacts Cleanup | ||
| run: rm -rf ./artifacts | ||
|
|
||
| integration_tests: | ||
| name: Integration Tests | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '11' | ||
| distribution: 'temurin' | ||
|
|
||
| # - name: Configure AWS Credentials | ||
| # uses: aws-actions/configure-aws-credentials@v4 | ||
| # with: | ||
| # role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
| # role-session-name: gp2gp_github_action_build_workflow | ||
| # aws-region: ${{ secrets.AWS_REGION }} | ||
|
|
||
| - name: Setup Required Docker Images | ||
| working-directory: ${{ inputs.path }} | ||
| run: docker compose up mongodb activemq fake-mesh -d | ||
|
|
||
| - name: Execute Integration Tests | ||
| working-directory: ${{ inputs.path }} | ||
| run: ./gradlew integrationTest | ||
|
|
||
| - name: Dump Docker Logs | ||
| if: always() | ||
| run: | | ||
| mkdir -p ./logs | ||
| container_names=$(docker ps -a --format '{{.Names}}') | ||
| for container in $container_names; do | ||
| docker logs "$container" > ./logs/"$container".log | ||
| echo "Logs saved for container: $container" | ||
| done | ||
| working-directory: ./scripts | ||
| shell: bash | ||
|
|
||
| - name: Collect Artifacts | ||
| if: always() | ||
| run: | | ||
| mkdir -p artifacts | ||
| cp -r ./${{ inputs.path }}/build/reports ./artifacts | ||
| cp -r ./scripts/logs ./artifacts | ||
|
|
||
| - name: Upload Artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: Integration Test Report & Docker Logs | ||
| path: ./artifacts/** | ||
| compression-level: 9 | ||
|
|
||
| - name: Test Job Summary | ||
| if: always() | ||
| uses: test-summary/action@v2 | ||
| with: | ||
| paths: "./${{ inputs.path }}/build/test-results/integrationTest/TEST-*.xml" | ||
|
|
||
| - name: Stop Docker Dependencies | ||
| if: always() | ||
| run: | | ||
| docker compose down --rmi=local --remove-orphans | ||
| docker compose rm | ||
MartinWheelerMT marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| working-directory: ./docker | ||
|
|
||
| - name: Temporary Artifacts Cleanup | ||
| run: rm -rf ./artifacts | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| public class MongoDbContainer extends GenericContainer<MongoDbContainer> { | ||
|
|
||
| public static final int MONGODB_PORT = 27017; | ||
| public static final String DEFAULT_IMAGE_AND_TAG = "mongo:3.2.4"; | ||
| public static final String DEFAULT_IMAGE_AND_TAG = "mongo:8.0"; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was updated due to TestContainers reporting the following issue due docker versioning on the GitHub runners: [DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of docker.io/library/mongo:3.2.4 to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2`. This change only affects the TestContainers startup stage for the integration tests. |
||
| private static MongoDbContainer container; | ||
|
|
||
| private MongoDbContainer() { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.