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.yaml
Christopher Fenner e11de9dbeb
chore(ci): add yamllint action (#2774)
* chore(ci): add yamllint action

* Create .yamllint.yml

* Update verify-yaml.yml

* Update verify-yaml.yml

* Update verify-yaml.yml

* Update verify-yaml.yml

* Update verify-yaml.yml

* correct yaml format

* correct yamllint findings

* disable truthy rule

* add pattern for workflows yamls

* fix c&p issue
2021-04-22 12:55:35 +02:00

77 lines
3.6 KiB
YAML

name: Integration Tests
on:
push:
branches:
- master
- it/**
workflow_dispatch:
jobs:
consumer-tests:
name: Consumer Tests
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- 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: get branch name
id: branchname
run: echo "::set-output name=branchname::$(echo ${GITHUB_REF#refs/heads/})"
- name: run consumer tests
run: cd consumer-test && groovy consumerTestController.groovy
env:
REPOSITORY_UNDER_TEST: ${{ github.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
steps:
- name: checkout
uses: actions/checkout@v2
- 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}}
PIPER_INTEGRATION_SONAR_TOKEN: ${{secrets.PIPER_INTEGRATION_SONAR_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}}'