Skip to content

Add pre-commit config. #45

Add pre-commit config.

Add pre-commit config. #45

Workflow file for this run

name: CI pipeline
on: push
jobs:
test_ubuntu_22:
runs-on: ubuntu-22.04
strategy:
matrix:
zeek: [{version: 6.0.2-0, tag: -lts}]
env:
ZEEK_VERSION: ${{ matrix.zeek.version }}
ZEEK_TAG: ${{ matrix.zeek.tag }}
steps:
- name: Prepare
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y curl ca-certificates
sudo pip3 install btest zkg pre-commit
- name: Install Zeek
run: |
(cd /tmp && curl -L -O https://download.zeek.org/binary-packages/xUbuntu_22.04/amd64/zeek${ZEEK_TAG}-core_${ZEEK_VERSION}_amd64.deb)
sudo apt install -y /tmp/zeek${ZEEK_TAG}-core_${ZEEK_VERSION}_amd64.deb
echo "/opt/zeek/bin:$PATH" >> $GITHUB_PATH
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Test
run: |
make test
- name: Check code
run: |
pre-commit run -a --show-diff-on-failure
- uses: actions/upload-artifact@v2
if: failure()
with:
name: Test output
path: |
tests/.tmp
zeek-agent/tests/.tmp
publish_release:
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
needs: [test_ubuntu_22]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build tarball
run: |
mkdir -p artifacts
export base="zeek-agent-package-$(echo ${{ github.ref_name }} | sed 's/^v//')"; git archive --format tar.gz --output "artifacts/${base}.tar.gz" --prefix "${base}" ${{ github.ref_name }}
- name: Prepare release message
run: |
cat CHANGES | awk '/^[0-9]+\./{ n++; next; } n < 2 { print }' >${{ runner.temp }}/release-msg
echo "release_name=$(echo ${{ github.ref_name }} | sed 's/^v//')" >> $GITHUB_ENV
- name: Display artifacts
run: ls -al artifacts/*
- name: Upload artifacts
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
name: ${{ env.release_name }}
body_path: ${{ runner.temp }}/release-msg
files: |
artifacts/*.tar.gz