Skip to content

Commit fe10e46

Browse files
authored
Update github actions versions (#447)
This PR uses the [`actions-up`](https://github.com/azat-io/actions-up) tool to update all GitHub actions to their latest release version, and uses commit SHAs to ensure only that version is used. It also re-instates the Windows tests to see if they'll succeed. * Fix Windows on GHA to not use make * Build docker image as tar in separate step * Use `golangci/golangci-lint` action in a separate workflow * Move publish of go stream perf test docker image to its own workflow * Use `nproc` to set `NUM_PROCS`
1 parent 968eaed commit fe10e46

File tree

7 files changed

+124
-84
lines changed

7 files changed

+124
-84
lines changed
File renamed without changes.

.ci/versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"erlang": "27.2",
3-
"rabbitmq": "4.0.5"
2+
"erlang": "27.3.4.6",
3+
"rabbitmq": "4.2.1"
44
}
Lines changed: 60 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,69 @@
11
name: Build and Test
22

33
on:
4+
pull_request:
5+
branches:
6+
- main
47
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
514

615
jobs:
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

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3939

4040
# Initializes the CodeQL tools for scanning.
4141
- name: Initialize CodeQL
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
# Optional: allow read access to pull requests. Use with `only-new-issues` option.
12+
# pull-requests: read
13+
14+
jobs:
15+
golangci:
16+
name: lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
20+
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
21+
with:
22+
go-version: stable
23+
- name: golangci-lint
24+
uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9.1.0
25+
with:
26+
version: v2.6
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish Go Stream Perf Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
17+
- uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
18+
with:
19+
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
22+
- name: Publish Docker Image
23+
run: |
24+
set -eux
25+
export VERSION=latest
26+
if [[ ! $GITHUB_REF =~ "/tags/" ]]
27+
then
28+
VERSION=dev
29+
fi
30+
make perf-test-docker-push

Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ fmt:
1717
go fmt ./...
1818

1919
check:
20-
golangci-lint run --fix
20+
golangci-lint run
2121

2222
NUM_PROCS ?= 2
2323
TEST_TIMEOUT ?= 3m
24-
test: vet fmt check
24+
test: vet fmt
2525
go run -mod=mod github.com/onsi/ginkgo/v2/ginkgo -r --procs=$(NUM_PROCS) --compilers=$(NUM_PROCS) \
2626
--randomize-all --randomize-suites \
2727
--cover --coverprofile=coverage.txt --covermode=atomic \
@@ -57,17 +57,16 @@ perf-test-docker-build: perf-test-build
5757
perf-test-docker-push: perf-test-docker-build
5858
$(BUILDKIT) push pivotalrabbitmq/go-stream-perf-test:$(VERSION)
5959

60-
RABBITMQ_OCI ?= rabbitmq:3-management
60+
RABBITMQ_OCI ?= rabbitmq:4-management
6161
BUILDKIT_RUN_ARGS ?= --pull always
6262
.PHONY: rabbitmq-server
6363
rabbitmq-server:
64-
$(BUILDKIT) build -t rabbitmq-tls-test -f CiDockerfile .
64+
$(BUILDKIT) build --tag rabbitmq-tls-test --file .ci/Dockerfile .
6565
$(BUILDKIT) run -it --rm --name rabbitmq-tls-test \
6666
-p 5552:5552 -p 5551:5551 -p 5672:5672 -p 15672:15672 \
6767
-e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-rabbitmq_stream advertised_host localhost" \
6868
rabbitmq-tls-test
6969

70-
7170
rabbitmq-ha-proxy:
7271
cd compose/ha_tls; rm -rf tls-gen;
7372
cd compose/ha_tls; git clone https://github.com/michaelklishin/tls-gen tls-gen; cd tls-gen/basic; make
@@ -87,10 +86,7 @@ rabbitmq-server-tls:
8786
-v $(shell pwd)/compose/tls/conf/:/etc/rabbitmq/ -v $(shell pwd)/compose/tls/tls-gen/basic/result/:/certs \
8887
-e RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="-rabbitmq_stream advertised_host localhost" \
8988
--pull always \
90-
docker.io/rabbitmq:3-management
89+
docker.io/rabbitmq:4-management
9190

9291
local-release:
9392
goreleaser release --skip-publish --rm-dist --skip=validate
94-
95-
96-

0 commit comments

Comments
 (0)