11name : Build and Test
22
33on :
4+ pull_request :
5+ branches :
6+ - main
47 push :
8+ branches :
9+ - main
10+ workflow_dispatch :
11+
12+ permissions :
13+ contents : read
514
615jobs :
7- test :
16+ docker-build :
817 runs-on : ubuntu-latest
9- strategy :
10- fail-fast : true
11- matrix :
12- go : ['1.24']
1318 steps :
14- - name : Checkout
15- uses : actions/checkout@v4
16- - name : Set up Docker Buildx
17- uses : docker/setup-buildx-action@v3
18- - name : Build and export
19- uses : docker/build-push-action@v5
19+ - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
20+ - uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
21+ - uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
2022 with :
2123 context : .
22- file : CiDockerfile
24+ file : ${{ github.workspace }}/.ci/Dockerfile
2325 tags : rabbitmq_tls:latest
2426 outputs : type=docker,dest=/tmp/rabbitmq_tls.tar
25- - name : Upload artifact
26- uses : actions/upload-artifact@v4
27+ - uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
2728 with :
2829 name : rabbitmq_tls
2930 path : /tmp/rabbitmq_tls.tar
30- - name : Download artifact
31- uses : actions/download-artifact@v4
31+ test :
32+ runs-on : ubuntu-latest
33+ needs : docker-build
34+ strategy :
35+ fail-fast : false
36+ matrix :
37+ go : ['1.24', '1.25']
38+ steps :
39+ - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
40+ - uses : actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
3241 with :
3342 name : rabbitmq_tls
3443 path : /tmp
35- - name : Load image
44+ - name : Load docker image
3645 run : |
3746 docker load --input /tmp/rabbitmq_tls.tar
3847 docker image ls -a
3948 docker run -d --rm --name rabbitmq-stream-client-test \
40- -p 5552:5552 -p 5672:5672 -p 5671:5671 -p 5551:5551 -p 15672:15672 \
41- -e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-rabbitmq_stream advertised_host localhost" \
42- rabbitmq_tls
43- - name : wait for running
49+ -p 5552:5552 -p 5672:5672 -p 5671:5671 -p 5551:5551 -p 15672:15672 \
50+ -e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-rabbitmq_stream advertised_host localhost" \
51+ rabbitmq_tls
52+ - name : Wait for RabbitMQ to start
4453 run : |
4554 docker exec rabbitmq-stream-client-test /bin/bash -c 'ps -aux'
4655 docker exec rabbitmq-stream-client-test /bin/bash -c 'sleep 10'
47- docker exec rabbitmq-stream-client-test /bin/bash -c 'rabbitmqctl status'
48- docker exec rabbitmq-stream-client-test /bin/bash -c 'rabbitmqctl wait --pid 1 --timeout 70'
49- - uses : actions/checkout@v4
50- - uses : actions/setup-go@v5
56+ docker exec rabbitmq-stream-client-test /bin/bash -c 'rabbitmqctl await_startup'
57+ - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
58+ - uses : actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
5159 id : setup_go
5260 with :
5361 go-version : ${{ matrix.go }}
5462 check-latest : true
55- - name : Install golangci-lint
56- run : go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
57- - run : make test GO_VERSION=${{ steps.setup_go.outputs.go-version }}
58- - uses : actions/checkout@main
59- - uses : codecov/codecov-action@v5
63+ - name : Get number of CPU cores
64+ run : echo "NUM_PROCS=$(nproc)" >> $GITHUB_ENV
65+ - run : make NUM_PROCS=$NUM_PROCS GO_VERSION=${{ steps.setup_go.outputs.go-version }} test
66+ - uses : codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
6067 with :
6168 fail_ci_if_error : false # optional (default = false)
6269 files : ./coverage.txt
@@ -65,48 +72,29 @@ jobs:
6572 verbose : true # optional (default = false)
6673 env :
6774 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
68- # temporany removed due of https://github.com/actions/checkout/issues/1186
69- # test-win32:
70- # runs-on: windows-latest
71- # strategy:
72- # matrix:
73- # go: [ '1.22']
74- # steps:
75- # - uses: actions/checkout@v4
76- # - uses: actions/setup-go@v5
77- # id: setup_go
78- # with:
79- # go-version: ${{ matrix.go }}
80- # check-latest: true
81- # - name: Cache installers
82- # uses: actions/cache@v4
83- # with:
84- # # Note: the cache path is relative to the workspace directory
85- # # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action
86- # path: ~/installers
87- # key: ${{ runner.os }}-v0-${{ hashFiles('.ci/versions.json') }}
88- # - name: Install and start RabbitMQ
89- # run: ./.ci/install.ps1
90- # - name: Install GNU make
91- # run: choco install make
92- # - run: make test GO_VERSION=${{ steps.setup_go.outputs.go-version }}
93- publish :
94- runs-on : ubuntu-latest
95- needs : [test]
75+ test-win32 :
76+ runs-on : windows-latest
9677 steps :
97- - uses : docker/setup-buildx-action@v2
98- - uses : docker/login-action@v2
78+ - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
79+ - uses : actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
80+ id : setup_go
9981 with :
100- username : ${{ secrets.DOCKERHUB_USERNAME }}
101- password : ${{ secrets.DOCKERHUB_TOKEN }}
102- - uses : actions/checkout@v3
103- - name : Publish Docker Image
82+ go-version : ' 1.25 '
83+ check-latest : true
84+ - name : Run Go checks
85+ shell : pwsh
10486 run : |
105- set -x
106- VERSION=latest
107- export VERSION
108- if [[ ! $GITHUB_REF =~ "/tags/" ]]
109- then
110- VERSION=dev
111- fi
112- make perf-test-docker-push
87+ go.exe vet ./pkg/stream
88+ go.exe fmt ./...
89+ - name : Cache installers
90+ uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
91+ with :
92+ # Note: the cache path is relative to the workspace directory
93+ # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action
94+ path : ~/installers
95+ key : ${{ runner.os }}-v0-${{ hashFiles('.ci/versions.json') }}
96+ - name : Install and start RabbitMQ
97+ run : ${{ github.workspace }}/.ci/install.ps1
98+ - name : Run Ginkgo test suite
99+ shell : pwsh
100+ run : go.exe run -mod=mod github.com/onsi/ginkgo/v2/ginkgo -r --procs=$env:NUMBER_OF_PROCESSORS --compilers=$env:NUMBER_OF_PROCESSORS --randomize-all --randomize-suites --cover --coverprofile=coverage.txt --covermode=atomic --race --trace --tags debug --timeout=5m
0 commit comments