- update deprecated action dependencies - remove go version matrix (track stable version) - optimize docker builds - comments, renamed workflow
104 lines
2.5 KiB
YAML
104 lines
2.5 KiB
YAML
name: Test Docker images
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- releases/**
|
|
paths-ignore:
|
|
- 'README.md'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- releases/**
|
|
paths-ignore:
|
|
- 'README.md'
|
|
|
|
jobs:
|
|
test_docker_image:
|
|
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:
|
|
config: .github/buildkit.toml
|
|
|
|
- name: "Build flavor: slim"
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
tags: crowdsecurity/crowdsec:test-slim
|
|
target: slim
|
|
platforms: linux/amd64
|
|
load: true
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=min
|
|
|
|
- name: "Build flavor: full"
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
tags: crowdsecurity/crowdsec:test
|
|
target: full
|
|
platforms: linux/amd64
|
|
load: true
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=min
|
|
|
|
- name: "Build flavor: full (debian)"
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.debian
|
|
tags: crowdsecurity/crowdsec:test-debian
|
|
target: full
|
|
platforms: linux/amd64
|
|
load: true
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=min
|
|
|
|
- name: "Setup Python"
|
|
uses: actions/setup-python@v4
|
|
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@v3
|
|
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: slim,debian
|
|
CROWDSEC_TEST_NETWORK: net-test
|
|
CROWDSEC_TEST_TIMEOUT: 90
|
|
run: |
|
|
cd docker/test
|
|
pipenv run pytest -n 2 --durations=0 --color=yes
|