Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-binary-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
steps:

- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.21.7
go-version-file: go.mod

- name: Build all platforms
run: |
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.21.7
go-version-file: go.mod

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: go, python

Expand All @@ -37,15 +37,11 @@ jobs:
make build

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.55
version: v1.64
args: --issues-exit-code=1 --timeout 10m
only-new-issues: false
# the cache is already managed above, enabling it here
# gives errors when extracting
skip-pkg-cache: true
skip-build-cache: true

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: Update the release draft
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
Expand Down
44 changes: 28 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.21.7
go-version-file: go.mod

- name: Build
run: |
Expand All @@ -38,21 +38,25 @@ jobs:
env:
RICHGO_FORCE_COLOR: 1

- name: Cache virtualenvs
id: cache-pipenv
uses: actions/cache@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
version: 0.5.24
enable-cache: true
cache-dependency-glob: "test/uv.lock"

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "test/.python-version"

- name: Install the project
working-directory: ./test
run: uv sync --all-extras --dev

- name: Install functional test dependencies
run: |
docker network create net-test
python3 -m pip install --upgrade pipenv wheel
pipenv install --deploy
# some tests need root, so we have to install pytest twice
sudo python3 -m pip install --upgrade pipenv wheel
sudo pipenv install --deploy

- name: Run functional tests
env:
Expand All @@ -61,18 +65,26 @@ jobs:
CROWDSEC_TEST_NETWORK: net-test
CROWDSEC_TEST_TIMEOUT: 60
PYTEST_ADDOPTS: --durations=0 -vv --color=yes -m "not (deb or rpm)"
working-directory: ./test
run: |
# everything except for
# - install (requires root, ignored by default)
# - deb/rpm (on their own workflows)
pipenv run pytest
uv run pytest
# these need root
sudo -E pipenv run pytest ./test/install/no_crowdsec
sudo -E $(which uv) run pytest ./tests/install/no_crowdsec
# these need a running crowdsec
docker run -d --name crowdsec -e CI_TESTING=true -e DISABLE_ONLINE_API=true -p 8080:8080 -ti crowdsecurity/crowdsec
install -m 0755 /dev/stdin /usr/local/bin/cscli <<'EOT'
#!/bin/sh
docker exec crowdsec cscli "$@"
EOT
sleep 5
sudo -E pipenv run pytest ./test/install/with_crowdsec
sudo -E $(which uv) run pytest ./tests/install/with_crowdsec

- name: Lint
working-directory: ./test
run: |
uv run ruff check
uv run basedpyright

34 changes: 20 additions & 14 deletions .github/workflows/tests_deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,36 @@ jobs:
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.21.7
go-version-file: go.mod

- name: Cache virtualenvs
id: cache-pipenv
uses: actions/cache@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
version: 0.5.24
enable-cache: true
cache-dependency-glob: "test/uv.lock"

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "test/.python-version"

- name: Install the project
run: uv sync --all-extras --dev
working-directory: ./test

- name: Install functional test dependencies
run: |
sudo apt update
sudo apt install -y build-essential debhelper devscripts fakeroot lintian
docker network create net-test
python3 -m pip install --upgrade pipenv wheel
pipenv install --deploy
sudo python3 -m pip install --upgrade pipenv wheel
sudo pipenv install --deploy

- name: Run functional tests
env:
Expand All @@ -50,6 +55,7 @@ jobs:
CROWDSEC_TEST_NETWORK: net-test
CROWDSEC_TEST_TIMEOUT: 60
PYTEST_ADDOPTS: --durations=0 -vv --color=yes
working-directory: ./test
run: |
pipenv run pytest test/pkg/test_build_deb.py
sudo -E pipenv run pytest -m deb ./test/install/no_crowdsec
uv run pytest ./tests/pkg/test_build_deb.py
sudo -E $(which uv) run pytest -m deb ./tests/install/no_crowdsec
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LD_OPTS_VARS=\
-X 'github.com/crowdsecurity/go-cs-lib/version.Tag=$(BUILD_TAG)'

export CGO_ENABLED=0
export LD_OPTS=-ldflags "-a -s -w -extldflags '-static' $(LD_OPTS_VARS)" \
export LD_OPTS=-ldflags "-s -extldflags '-static' $(LD_OPTS_VARS)" \
-trimpath -tags netgo

.PHONY: all
Expand Down
14 changes: 0 additions & 14 deletions Pipfile

This file was deleted.

Loading
Loading