Skip to content

build(deps): bump golang from 079e598 to ae5a231 #1233

build(deps): bump golang from 079e598 to ae5a231

build(deps): bump golang from 079e598 to ae5a231 #1233

Workflow file for this run

name: CI
on: [push, pull_request]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
tests:
runs-on: ubuntu-latest
services:
ctfd:
image: ctfd/ctfd:3.8.0@sha256:61712c4af6e9cddccfafc4503484c8091f6325be286d407595b922dc9552b5ae
ports:
- 8000:8000
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: 'go.mod'
- name: Cache go modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Run unit tests
run: |
go test ./ -run=^Test_U -coverprofile=unit.cov
env:
CTFD_URL: http://localhost:8000 # needed because TestMain looks for it, we actually don't use it
- name: Wait for CTFd server
run: |
max_attempts=60
base_url="http://localhost:8000"
for ((i=0; i<$max_attempts; i++)); do
if curl --head --fail --silent --show-error "$base_url" >/dev/null; then
echo "Server is up and running!"
break
else
echo "Waiting for the server to respond... (attempt $((i+1)))"
sleep 5
fi
done
if [ $i -eq $max_attempts ]; then
echo "Server did not respond within the allotted time. Exiting..."
exit 1
fi
- name: Run integration tests
run: |
go test ./ -run=^Test_I_ -v -cover -coverprofile=integration.cov
go tool covdata textfmt -i=coverdir -o merged.cov
sed -i '/^\//d' merged.cov
env:
CTFD_URL: http://localhost:8000
- name: Merge coverage data
run: |
go install go.shabbyrobe.org/gocovmerge/cmd/gocovmerge@fa4f82cfbf4d57c646c1ed0f35002bf1b89fbf7a
gocovmerge unit.cov integration.cov merged.cov > all.cov
- name: Upload coverage to Coveralls
uses: shogo82148/actions-goveralls@9606dbc5ac5cf888a0e9ef901515c3cd516a2790 # v1.11.0
with:
path-to-profile: all.cov
go-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
- name: go-lint
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9.2.1