-
Notifications
You must be signed in to change notification settings - Fork 16
88 lines (73 loc) · 3.03 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
on:
- push
- workflow_dispatch
- pull_request
name: CI
jobs:
integrationTest:
name: Integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
- name: Retrieve branch name
id: branch_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Fix code style
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
run: ./gradlew spotlessApply
- uses: stefanzweifel/git-auto-commit-action@v4
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
with:
commit_message: "spotless: Fix code style"
commit_user_name: automation-commercetools
commit_user_email: [email protected]
commit_author: Auto Mation <[email protected]>
- name: License check
run: ./gradlew checkLicense
- uses: stefanzweifel/git-auto-commit-action@v4
if: github.event_name == 'push'
with:
file_pattern: 'licenses/index.json licenses/**/index.json'
commit_message: "TASK: Updating license information"
commit_user_name: automation-commercetools
commit_user_email: [email protected]
commit_author: Auto Mation <[email protected]>
disable_globbing: true
- name: Run integration tests for PR
if: github.event_name == 'pull_request'
run: ./gradlew clean build runMainMethodThreadLeakTest
env:
CTP_CLIENT_ID: ${{ secrets.CTP_CLIENT_ID_PR }}
CTP_CLIENT_SECRET: ${{ secrets.CTP_CLIENT_SECRET_PR }}
CTP_PROJECT_KEY: ${{ secrets.CTP_PROJECT_KEY_PR }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
CTP_JVM_SDK_LOG_LEVEL: OFF
- name: Run integration tests
if: github.event_name != 'pull_request'
run: ./gradlew clean build runMainMethodThreadLeakTest
env:
CTP_CLIENT_ID: ${{ secrets.CTP_CLIENT_ID }}
CTP_CLIENT_SECRET: ${{ secrets.CTP_CLIENT_SECRET }}
CTP_PROJECT_KEY: ${{ secrets.CTP_PROJECT_KEY }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
CTP_JVM_SDK_LOG_LEVEL: OFF
- name: Test examples
run: |
./gradlew publishMavenPublicationToMavenLocal
cd examples/maven-okhttp3 && mvn verify --no-transfer-progress
cd ../maven-okhttp4 && mvn verify --no-transfer-progress
- name: Collect code coverage
run: ./gradlew codeCoverageReport
- name: Send code coverage report to Codecov.io
run: bash <(curl -s https://codecov.io/bash) || true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}