1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/.github/workflows/integration-tests-pr.yaml
Florian Wilhelm 485faed812
Reduce go binary size by updating to go 1.15 (#1968)
* Update go to 1.15 to reduce binary size

Go made improvements to reduce binary size, cf https://golang.org/doc/go1.15

> Go 1.15 reduces typical binary sizes by around 5% compared to Go 1.14 by eliminating certain types of GC metadata and more aggressively eliminating unused type metadata.

In my test, this equates to about 3 mb diff between Go 1.13 and Go 1.15:

-rwxr-xr-x 1 root root 36M Aug 31 14:43 piper-go-113
-rwxr-xr-x 1 root root 33M Aug 31 14:44 piper-go-115

* Go Generate

* go mod tidy

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2020-09-17 08:44:42 +02:00

97 lines
5.3 KiB
YAML

name: Integration Tests (Pull Request)
on:
issue_comment:
types: [created]
jobs:
consumer-tests:
name: Consumer Tests
runs-on: ubuntu-latest
if: github.event.comment.body == '/it' && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER')
steps:
- name: get pull request url
id: pullrequest
run: echo "::set-output name=pullrequest::$(curl ${{ github.event.comment.issue_url }} | jq '.pull_request.url' | sed 's/\"//g')"
- name: get branch name
id: branchname
run: echo "::set-output name=branchname::$(curl ${{ steps.pullrequest.outputs.pullrequest }} | jq '.head.ref' | sed 's/\"//g')"
- name: get repository
id: repository
run: echo "::set-output name=repository::$(curl ${{ steps.pullrequest.outputs.pullrequest }} | jq '.head.repo.full_name' | sed 's/\"//g')"
- name: checkout
uses: actions/checkout@v2
with:
repository: ${{ steps.repository.outputs.repository }}
ref: ${{ steps.branchname.outputs.branchname }}
- uses: actions/setup-java@v1
with:
java-version: '11'
- name: install groovy
run: sudo apt-get update && sudo apt-get install groovy -y
- name: setup git
run: git config --global user.email "piper-testing-bot@example.com" && git config --global user.name "piper-testing-bot"
- name: run consumer tests
run: cd consumer-test && groovy consumerTestController.groovy
env:
REPOSITORY_UNDER_TEST: ${{ steps.repository.outputs.repository }}
BRANCH_NAME: ${{ steps.branchname.outputs.branchname }}
BUILD_WEB_URL: https://github.com/SAP/jenkins-library/actions/runs/${{ github.run_id }}
INTEGRATION_TEST_VOTING_TOKEN: ${{ secrets.INTEGRATION_TEST_VOTING_TOKEN }}
CX_INFRA_IT_CF_USERNAME: ${{ secrets.CX_INFRA_IT_CF_USERNAME }}
CX_INFRA_IT_CF_PASSWORD: ${{ secrets.CX_INFRA_IT_CF_PASSWORD }}
NEO_DEPLOY_USERNAME: ${{ secrets.NEO_DEPLOY_USERNAME }}
NEO_DEPLOY_PASSWORD: ${{ secrets.NEO_DEPLOY_PASSWORD }}
CX_INFRA_IT_TMS_UPLOAD: ${{ secrets.CX_INFRA_IT_TMS_UPLOAD }}
go-integration-tests:
name: Go Integration Tests
runs-on: ubuntu-latest
if: (github.event.comment.body == '/it' || github.event.comment.body == '/it-go') && (github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER')
steps:
- name: get pull request url
id: pullrequest
run: echo "::set-output name=pullrequest::$(curl ${{ github.event.comment.issue_url }} | jq '.pull_request.url' | sed 's/\"//g')"
- name: get branch name
id: branchname
run: echo "::set-output name=branchname::$(curl ${{ steps.pullrequest.outputs.pullrequest }} | jq '.head.ref' | sed 's/\"//g')"
- name: get repository
id: repository
run: echo "::set-output name=repository::$(curl ${{ steps.pullrequest.outputs.pullrequest }} | jq '.head.repo.full_name' | sed 's/\"//g')"
- name: checkout
uses: actions/checkout@v2
with:
repository: ${{ steps.repository.outputs.repository }}
ref: ${{ steps.branchname.outputs.branchname }}
- name: get commit id
id: commitId
run: echo "::set-output name=commitId::$(git log --format=%H -n 1)"
- name: update status
run: |
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}}'
- uses: actions/setup-go@v1
with:
go-version: '1.15.x'
- name: build
env:
CGO_ENABLED: 0
# with `-tags release` we ensure that shared test utilities won't end up in the binary
run: go build -o piper -tags release
- name: test
env:
PIPER_INTEGRATION_GITHUB_TOKEN: ${{secrets.PIPER_INTEGRATION_GITHUB_TOKEN}}
run: go test -tags=integration -timeout 20m ./integration/...
- name: update status
if: success()
run: |
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}}'
- name: update status
if: cancelled() || failure()
run: |
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}}'