update CI and go dependencies #195
Workflow file for this run
This file contains hidden or 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: Build + tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: "Build + tests" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build | |
| run: | | |
| make build | |
| - name: Run unit tests | |
| run: | | |
| go install github.com/kyoh86/[email protected] | |
| set -o pipefail | |
| make test | richgo testfilter | |
| env: | |
| RICHGO_FORCE_COLOR: 1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0 | |
| with: | |
| version: 0.5.24 | |
| enable-cache: true | |
| cache-dependency-glob: "test/uv.lock" | |
| - name: "Set up Python" | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| 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 | |
| - name: Run functional tests | |
| env: | |
| CROWDSEC_TEST_VERSION: dev | |
| CROWDSEC_TEST_FLAVORS: full | |
| 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) | |
| uv run pytest | |
| # these need root | |
| 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 -e CROWDSEC_BYPASS_DB_VOLUME_CHECK=true -p 8080:8080 -ti crowdsecurity/crowdsec | |
| cat >/usr/local/bin/cscli <<'EOT' | |
| #!/bin/sh | |
| docker exec crowdsec cscli "$@" | |
| EOT | |
| chmod u+x /usr/local/bin/cscli | |
| sleep 5 | |
| sudo -E $(which uv) run pytest ./tests/install/with_crowdsec | |
| - name: Lint | |
| working-directory: ./test | |
| run: | | |
| uv run ruff check | |
| uv run basedpyright | |