Skip to content

Commit

Permalink
Multi-platform CI and Makefile removal (#1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
cretz authored Nov 28, 2023
1 parent 70c8400 commit 33e8360
Show file tree
Hide file tree
Showing 13 changed files with 667 additions and 148 deletions.
83 changes: 60 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,81 @@ jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ["1.20", "1.21"]
runs-on: ubuntu-latest
include:
- os: ubuntu-latest
go-version: "1.21"
# 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
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-go@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Check and unit test
run: make check unit-test
- name: Clone Temporal Docker compose

- name: Check
run: go run . check
working-directory: ./internal/cmd/build

- name: Unit test
run: go run . unit-test -coverage=${{ matrix.uploadCoverage && 'true' || 'false' }}
working-directory: ./internal/cmd/build

- name: Integration tests (without cache)
run: go run . integration-test -dev-server
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
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: Docker compose - checkout
if: ${{ matrix.testDockerCompose }}
uses: actions/checkout@v3
with:
repository: temporalio/docker-compose
path: ./docker-compose
- name: Start Temporal server

- 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: Integration tests (without cache)
run: make integration-test-zero-cache
- name: Integration tests (with cache)
run: make integration-test-normal-cache
- name: Merge coverage files
id: merge-coverage-files
run: |
COVERAGE_FILE="$(mktemp)"
echo "COVERAGE_FILE=$COVERAGE_FILE" >> "$GITHUB_OUTPUT"
make merge-coverage > "$COVERAGE_FILE"
- name: Upload coverage
continue-on-error: true
uses: coverallsapp/github-action@v2
with:
file: ${{ steps.merge-coverage-files.outputs.COVERAGE_FILE }}
format: golang
- name: Docker compose - integration tests
if: ${{ matrix.testDockerCompose }}
run: go run . integration-test
working-directory: ./internal/cmd/build

cloud-test:
strategy:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ test.log
.bins
.DS_Store
.gobincache
go.work
go.work.sum
15 changes: 9 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This project is Open Source Software, and requires a header at the beginning of
all source files. To verify that all files contain the header execute:

```bash
make copyright
go run ./internal/cmd/tools/copyright/licensegen.go
```

## Commit Messages And Titles of Pull Requests
Expand All @@ -49,17 +49,20 @@ All PR titles should start with Upper case.
Run all static analysis tools:

```bash
make check
cd ./internal/cmd/build
go run . check
```

Run all the tests (including integration tests, which require you to [run a server locally](https://docs.temporal.io/docs/server/quick-install/)) with coverage and race detector enabled:
Run the integration tests (requires local server running, or pass `-dev-server`):

```bash
make test
cd ./internal/cmd/build
go run . integration-test
```

To run just the unit tests:
Run the unit tests:

```bash
make unit-test
cd ./internal/cmd/build
go run . unit-test
```
95 changes: 0 additions & 95 deletions Makefile

This file was deleted.

43 changes: 43 additions & 0 deletions internal/cmd/build/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module go.temporal.io/sdk/internal/cmd/build

go 1.20

require (
github.com/BurntSushi/toml v1.2.1
github.com/kisielk/errcheck v1.6.3
go.temporal.io/sdk v1.25.1
honnef.co/go/tools v0.4.6
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
go.temporal.io/api v1.26.1-0.20231121220434-5a4d95cc60c0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.1-0.20230825192346-2191a27a6dc5 // indirect
google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace go.temporal.io/sdk => ../../../
Loading

0 comments on commit 33e8360

Please sign in to comment.