Ping-related improvements #638
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
test: | |
if: "!contains(github.event.head_commit.message, '[ci skip tests]')" | |
strategy: | |
matrix: | |
go-version: [1.20.x] | |
runs-on: ubuntu-20.04 | |
env: | |
GO111MODULE: on | |
GOFLAGS: "-mod=vendor" | |
COVERAGE: "true" | |
REDIS_URL: "redis://localhost:6379/2" | |
services: | |
redis: | |
image: redis:7.0-alpine | |
ports: ["6379:6379"] | |
options: --health-cmd="redis-cli ping" --health-interval 1s --health-timeout 3s --health-retries 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install system deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install bison | |
- uses: actions/cache@v1 | |
with: | |
path: vendor | |
key: vendor-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
vendor- | |
- run: go mod vendor | |
- name: Build mruby | |
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)' | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Run tests | |
run: make test | |
- name: Report coverage | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: coverage.out | |
parallel: true | |
flag-name: ${{ matrix.go-version }}-ubuntu | |
- name: Build | |
if: matrix['go-version'] == '1.20.x' | |
run: | | |
make build | |
- name: Upload linux build | |
if: matrix['go-version'] == '1.20.x' && (github.ref == 'refs/head/master' || contains(github.event.pull_request.body, '[Build]')) | |
uses: actions/upload-artifact@v1 | |
with: | |
name: anycable-go-Linux-x86_64 | |
path: dist/anycable-go | |
test-macos: | |
if: "!contains(github.event.head_commit.message, '[ci skip tests]')" | |
strategy: | |
matrix: | |
go-version: [1.20.x] | |
runs-on: macos-11 | |
env: | |
GO111MODULE: on | |
GOFLAGS: "-mod=vendor" | |
COVERAGE: "true" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Install system deps | |
run: | | |
brew install bison | |
- uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: vendor-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
vendor- | |
- run: go mod vendor | |
- name: Build mruby | |
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)' | |
- name: Run tests | |
run: make test | |
- name: Report coverage | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: coverage.out | |
parallel: true | |
flag-name: ${{ matrix.go-version }}-macos | |
- name: Build | |
if: matrix['go-version'] == '1.20.x' | |
run: | | |
make build | |
- name: Upload MacOS build | |
if: matrix['go-version'] == '1.20.x' && (github.ref == 'refs/head/master' || contains(github.event.pull_request.body, '[Build]')) | |
uses: actions/upload-artifact@v1 | |
with: | |
name: anycable-go-Darwin-x86_64 | |
path: dist/anycable-go | |
test-conformance: | |
if: "!contains(github.event.head_commit.message, '[ci skip tests]')" | |
needs: [test, test-macos] | |
strategy: | |
matrix: | |
test_command: | |
- benchmarks | |
- test-features | |
- test-conformance | |
- test-conformance-http | |
- test-conformance-nats | |
- test-conformance-nats-embedded | |
- test-conformance-ssl | |
- test-conformance-broker-http | |
- test-conformance-broker-redis | |
- test-conformance-broker-nats | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: on | |
GOFLAGS: "-mod=vendor" | |
BUILD_ARGS: "-race" | |
GORACE: "halt_on_error=1" | |
COVERAGE: "true" | |
GOCOVERDIR: "_icoverdir_" | |
BUNDLE_GEMFILE: .circleci/Gemfile | |
BUNDLE_PATH: ./vendor/bundle | |
# Specify REDIS_URL explicitly, so Makefile doesn't check the presence of Redis | |
REDIS_URL: redis://localhost:6379/ | |
ANYCABLE_DISABLE_TELEMETRY: "true" | |
services: | |
redis: | |
image: redis:6.2-alpine | |
ports: ["6379:6379"] | |
options: --health-cmd="redis-cli ping" --health-interval 1s --health-timeout 3s --health-retries 30 | |
nats: | |
image: nats:alpine | |
ports: ["4222:4222"] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.20.x | |
- name: Install system deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install bison | |
- uses: ruby/setup-ruby@v1 | |
with: | |
# Use <3.0 since go-mruby's Rakefile has some problems with keyword arguments compatibility | |
ruby-version: 2.7 | |
bundler-cache: true | |
- uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: vendor-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
vendor- | |
- run: go mod vendor | |
- name: Build mruby | |
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)' | |
- name: Install websocket-bench & gops | |
if: matrix.test_command == 'benchmarks' | |
env: | |
GO111MODULE: off | |
run: | | |
go get -u github.com/anycable/websocket-bench | |
go get -u github.com/google/gops | |
- name: Run tests | |
run: | | |
bundle install | |
mkdir _icoverdir_ | |
make ${{ matrix.test_command }} | |
- name: Format coverage | |
continue-on-error: true | |
run: | | |
go tool covdata textfmt -i _icoverdir_ -o coverage.out | |
- name: Check if has coverage? | |
id: coverage | |
run: | | |
if [ -s coverage.out ]; then | |
echo "coverage found" | |
echo "COVERAGE=yes" >> $GITHUB_OUTPUT | |
else | |
echo "no coverage found" | |
echo "COVERAGE=no" >> $GITHUB_OUTPUT | |
fi | |
- name: Report coverage | |
if: steps.coverage.outputs.COVERAGE == 'yes' | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: coverage.out | |
parallel: true | |
format: golang | |
flag-name: integration-${{ matrix.test_command }} | |
coverage: | |
runs-on: ubuntu-latest | |
needs: [test, test-macos, test-conformance] | |
steps: | |
- uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true |