Skip to content

fix: ci tests and descriptions #29

fix: ci tests and descriptions

fix: ci tests and descriptions #29

Workflow file for this run

name: Test Build
on:
workflow_dispatch:
release:
types: [released]
push:
branches:
- "main"
schedule:
- cron: '12 6 3 * *'
jobs:
build:
strategy:
matrix:
containers:
- file: files/Dockerfile
tags: |
irulescan:latest
- file: files/Dockerfile.apiserver
tags: |
irulescan:apiserver
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
- name: Install jd
run: |
go install github.com/josephburnett/[email protected]
echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build container image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.containers.file }}
platforms: linux/amd64
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ matrix.containers.tags }}
- name: Run container test on single file
if: ${{ matrix.containers.file == 'files/Dockerfile' }}
run: |
cat tests/basic/dangerous.tcl | docker run --rm -i -v "$PWD/tests:/scandir/tests" \
irulescan:latest check -r 'tests/basic/dangerous.tcl.stdin.json' -
- name: Run container tests on directory
if: ${{ matrix.containers.file == 'files/Dockerfile' }}
run: |
docker run --rm -v ${PWD}/tests/basic:/scandir \
irulescan:latest > output.json
jd -mset output.json tests/basic/irulescan.json || exit 1
- name: Start apiserver in background
if: ${{ matrix.containers.file == 'files/Dockerfile.apiserver' }}
run: |
docker run --rm -p 8888:80 -d \
irulescan:apiserver
sleep 10
- name: Run apiserver scanfiles test
if: ${{ matrix.containers.file == 'files/Dockerfile.apiserver' }}
run: |
curl -s http://localhost:8888/scanfiles/ \
-F 'file=@tests/basic/ok.tcl' \
-F 'file=@tests/basic/warning.tcl' \
-F 'file=@tests/basic/dangerous.tcl' > output.json
jd -mset output.json tests/basic/irulescan.json || exit 1
- name: Run apiserver scan test
if: ${{ matrix.containers.file == 'files/Dockerfile.apiserver' }}
run: |
curl -s http://localhost:8888/scan/ \
--data-binary '@tests/basic/dangerous.tcl' > output.json
jd -mset output.json tests/basic/dangerous.tcl.stdin.json || exit 1