lint: enable (some) gocritic checks (#3238) #189
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 Docker images | |
on: | |
push: | |
branches: | |
- master | |
- releases/** | |
paths-ignore: | |
- 'README.md' | |
pull_request: | |
branches: | |
- master | |
- releases/** | |
paths-ignore: | |
- 'README.md' | |
jobs: | |
test_flavor: | |
strategy: | |
# we could test all the flavors in a single pytest job, | |
# but let's split them (and the image build) in multiple runners for performance | |
matrix: | |
# can be slim, full or debian (no debian slim). | |
flavor: ["slim", "debian"] | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
buildkitd-config: .github/buildkit.toml | |
- name: "Build image" | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile${{ matrix.flavor == 'debian' && '.debian' || '' }} | |
tags: crowdsecurity/crowdsec:test${{ matrix.flavor == 'full' && '' || '-' }}${{ matrix.flavor == 'full' && '' || matrix.flavor }} | |
target: ${{ matrix.flavor == 'debian' && 'full' || matrix.flavor }} | |
platforms: linux/amd64 | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=min | |
- name: "Setup Python" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: "Install pipenv" | |
run: | | |
cd docker/test | |
python -m pip install --upgrade pipenv wheel | |
- name: "Cache virtualenvs" | |
id: cache-pipenv | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local/share/virtualenvs | |
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} | |
- name: "Install dependencies" | |
if: steps.cache-pipenv.outputs.cache-hit != 'true' | |
run: | | |
cd docker/test | |
pipenv install --deploy | |
- name: "Create Docker network" | |
run: docker network create net-test | |
- name: "Run tests" | |
env: | |
CROWDSEC_TEST_VERSION: test | |
CROWDSEC_TEST_FLAVORS: ${{ matrix.flavor }} | |
CROWDSEC_TEST_NETWORK: net-test | |
CROWDSEC_TEST_TIMEOUT: 90 | |
# running serially to reduce test flakiness | |
run: | | |
cd docker/test | |
pipenv run pytest -n 1 --durations=0 --color=yes |