github.com/jaylevin/jenkins-library@v1.230.4/.github/workflows/integration-tests.yaml (about)

     1  name: Integration Tests
     2  
     3  on:
     4    push:
     5      branches:
     6        - master
     7        - it/**
     8    workflow_dispatch:
     9  
    10  jobs:
    11  
    12    consumer-tests:
    13      name: Consumer Tests
    14      runs-on: ubuntu-latest
    15  
    16      steps:
    17        - name: checkout
    18          uses: actions/checkout@v2
    19        - uses: actions/setup-java@v1
    20          with:
    21            java-version: '11'
    22        - name: install groovy
    23          run: sudo apt-get update && sudo apt-get install groovy -y
    24        - name: setup git
    25          run: git config --global user.email "piper-testing-bot@example.com" && git config --global user.name "piper-testing-bot"
    26        - name: get branch name
    27          id: branchname
    28          run: echo "::set-output name=branchname::$(echo ${GITHUB_REF#refs/heads/})"
    29        - name: run consumer tests
    30          run: cd consumer-test && groovy consumerTestController.groovy
    31          env:
    32            REPOSITORY_UNDER_TEST: ${{ github.repository }}
    33            BRANCH_NAME: ${{ steps.branchname.outputs.branchname }}
    34            BUILD_WEB_URL: https://github.com/SAP/jenkins-library/actions/runs/${{ github.run_id }}
    35            INTEGRATION_TEST_VOTING_TOKEN: ${{ secrets.INTEGRATION_TEST_VOTING_TOKEN }}
    36            CX_INFRA_IT_CF_USERNAME: ${{ secrets.CX_INFRA_IT_CF_USERNAME }}
    37            CX_INFRA_IT_CF_PASSWORD: ${{ secrets.CX_INFRA_IT_CF_PASSWORD }}
    38            NEO_DEPLOY_USERNAME: ${{ secrets.NEO_DEPLOY_USERNAME }}
    39            NEO_DEPLOY_PASSWORD: ${{ secrets.NEO_DEPLOY_PASSWORD }}
    40            CX_INFRA_IT_TMS_UPLOAD: ${{ secrets.CX_INFRA_IT_TMS_UPLOAD }}
    41  
    42    go-integration-tests:
    43      name: Go Integration Tests
    44  
    45      runs-on: ubuntu-latest
    46  
    47      steps:
    48        - name: checkout
    49          uses: actions/checkout@v2
    50        - name: get commit id
    51          id: commitId
    52          run: echo "::set-output name=commitId::$(git log --format=%H -n 1)"
    53        - name: update status
    54          run: |
    55            curl --location --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ steps.commitId.outputs.commitId }}' -H 'Content-Type: application/json' --data '{"state": "pending", "context": "Go / integration-tests", "target_url": "https://github.com/SAP/jenkins-library/actions/runs/${{ github.run_id }}"}' -H 'Authorization: token ${{secrets.INTEGRATION_TEST_VOTING_TOKEN}}'
    56        - uses: actions/setup-go@v1
    57          with:
    58            go-version: '1.18.x'
    59        - name: build
    60          env:
    61            CGO_ENABLED: 0
    62          # with `-tags release` we ensure that shared test utilities won't end up in the binary
    63          run: go build -o piper -tags release
    64        - name: test
    65          env:
    66            PIPER_INTEGRATION_GITHUB_TOKEN: ${{secrets.PIPER_INTEGRATION_GITHUB_TOKEN}}
    67            PIPER_INTEGRATION_SONAR_TOKEN: ${{secrets.PIPER_INTEGRATION_SONAR_TOKEN}}
    68          run: go test -tags=integration -timeout 25m ./integration/...
    69        - name: update status
    70          if: success()
    71          run: |
    72            curl --location --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ steps.commitId.outputs.commitId }}' -H 'Content-Type: application/json' --data '{"state": "success", "context": "Go / integration-tests", "target_url": "https://github.com/SAP/jenkins-library/actions/runs/${{ github.run_id }}"}' -H 'Authorization: token ${{secrets.INTEGRATION_TEST_VOTING_TOKEN}}'
    73        - name: update status
    74          if: cancelled() || failure()
    75          run: |
    76            curl --location --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ steps.commitId.outputs.commitId }}' -H 'Content-Type: application/json' --data '{"state": "failure", "context": "Go / integration-tests", "target_url": "https://github.com/SAP/jenkins-library/actions/runs/${{ github.run_id }}"}' -H 'Authorization: token ${{secrets.INTEGRATION_TEST_VOTING_TOKEN}}'