-
Notifications
You must be signed in to change notification settings - Fork 208
159 lines (139 loc) · 5.92 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Continuous Integration
on:
pull_request:
push:
branches:
- master
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-intel, macos-arm, windows-latest]
go-version: ["oldstable", "stable"]
include:
- os: ubuntu-latest
go-version: "stable"
# We only want to upload coverage on a single target
uploadCoverage: true
# We only want to check docker compose on a single target
testDockerCompose: true
- os: macos-intel
runsOn: macos-12
- os: macos-arm
runsOn: macos-14
runs-on: ${{ matrix.runsOn || matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Check
run: go run . check
working-directory: ./internal/cmd/build
- name: Unit test
run: go run . unit-test -coverage=${{ matrix.uploadCoverage && 'true' || 'false' }} -junit-file-stem ${{matrix.os}}-${{matrix.go-version}}
working-directory: ./internal/cmd/build
- name: Integration tests (without cache)
run: go run . integration-test -dev-server -junit-file-stem ${{matrix.os}}-${{matrix.go-version}}-nocache
working-directory: ./internal/cmd/build
env:
WORKFLOW_CACHE_SIZE: "0"
TEMPORAL_COVERAGE_FILE: ${{ matrix.uploadCoverage && 'integ_test_zero_cache_cover.out' || '' }}
- name: Integration tests (with cache)
run: go run . integration-test -dev-server -junit-file-stem ${{matrix.os}}-${{matrix.go-version}}-cache
working-directory: ./internal/cmd/build
env:
TEMPORAL_COVERAGE_FILE: ${{ matrix.uploadCoverage && 'integ_test_normal_cache_cover.out' || '' }}
- name: Merge coverage files
if: ${{ matrix.uploadCoverage }}
run: go run . merge-coverage-files ../../../coverage.out
working-directory: ./internal/cmd/build
- name: Upload coverage
if: ${{ matrix.uploadCoverage }}
continue-on-error: true
uses: coverallsapp/github-action@v2
with:
file: coverage.out
format: golang
- name: Upload junit-xml artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: junit-xml--${{github.run_id}}--${{github.run_attempt}}--${{matrix.os}}-${{matrix.go-version}}
path: .build/junit-xml
retention-days: 14
- name: Docker compose - checkout
if: ${{ matrix.testDockerCompose }}
uses: actions/checkout@v4
with:
repository: temporalio/docker-compose
path: ./docker-compose
- name: Docker compose - start
if: ${{ matrix.testDockerCompose }}
run: |
cp ./.github/workflows/docker/docker-compose.override.yaml ./docker-compose/docker-compose.override.yaml
cp ./.github/workflows/docker/dynamic-config-custom.yaml ./docker-compose/dynamicconfig/dynamic-config-custom.yaml
docker compose --project-directory ./docker-compose up &
go run ./.github/workflows/wait_for_server.go
- name: Docker compose - integration tests
if: ${{ matrix.testDockerCompose }}
run: go run . integration-test
env:
# TODO(bergundy): Remove this flag once server 1.25.0 is out.
DISABLE_NEXUS_TESTS: "1"
# TODO(bergundy): Remove this flag too once server 1.25.0 is out. Thanks Roey! :)
DISABLE_BACKLOG_STATS_TESTS: "1"
# TODO(cretz): Remove this flag once server 1.25.0 is out.
DISABLE_USER_METADATA_TESTS: "1"
working-directory: ./internal/cmd/build
cloud-test:
strategy:
matrix:
go-version: ["oldstable", "stable"]
# Try to avoid running tests in parallel to avoid workflow ID conflict
max-parallel: 1
# Only supported in non-fork runs, since secrets are not available in forks.
if: ${{ github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/sdk-go' }}
runs-on: ubuntu-latest
env:
SERVICE_ADDR: sdk-ci.a2dd6.tmprl.cloud:7233
TEMPORAL_NAMESPACE: sdk-ci.a2dd6
TEMPORAL_CLIENT_CERT: ${{ secrets.TEMPORAL_CLIENT_CERT }}
TEMPORAL_CLIENT_KEY: ${{ secrets.TEMPORAL_CLIENT_KEY }}
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: 2024-05-13-00
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Create junit-xml directory
run: mkdir junit-xml-cloud
- name: Single integration test against cloud
run: 'gotestsum --junitfile ../junit-xml-cloud/${{matrix.go-version}}-integration.xml -- -v --count 1 -p 1 . -run "TestIntegrationSuite/TestBasic$"'
working-directory: test
- name: Cloud operations tests
run: 'gotestsum --junitfile ../junit-xml-cloud/${{matrix.go-version}}-cloud-operations.xml -- -v --count 1 -p 1 . -run "TestCloudOperationsSuite/.*" -cloud-operations-tests'
working-directory: test
- name: Upload junit-xml artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: junit-xml-cloud--${{github.run_id}}--${{github.run_attempt}}--${{matrix.go-version}}
path: junit-xml-cloud
retention-days: 14
features-test:
uses: temporalio/features/.github/workflows/go.yaml@main
with:
go-repo-path: ${{github.event.pull_request.head.repo.full_name}}
version: ${{github.event.pull_request.head.ref}}
version-is-repo-ref: true