-
Notifications
You must be signed in to change notification settings - Fork 50
122 lines (108 loc) · 3.9 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Continuous integration
on:
push:
branches:
- master
- "feature/**"
- "releases/**"
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
defaults:
run:
shell: bash
jobs:
test:
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-22.04, macos-latest, macos-14]
go: [stable, 1.23.x, 1.22.x, 1.21.x]
name: Go ${{ matrix.go }} tests @ ${{ matrix.os }} for hyperscan
runs-on: ${{ matrix.os }}
steps:
- name: Install Linux dependencies for testing libraries
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt-get update
sudo apt-get install -yq libhyperscan-dev libpcap-dev
- name: Install MacOS dependencies for testing libraries
if: startsWith(matrix.os, 'macos-')
run: |
brew install vectorscan libpcap
- uses: actions/checkout@v4
- name: Install Golang ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Test Hyperscan v4 API
run: |
go test -v -tags hyperscan_v4 ./internal/hs/... ./hyperscan/...
go test -race -v -tags hyperscan_v4 ./internal/hs/... ./hyperscan/...
- name: Test Hyperscan v5 API
run: |
go test -v ./internal/hs/... ./hyperscan/...
go test -race -v ./internal/hs/... ./hyperscan/...
build-and-test:
strategy:
matrix:
include:
- os: macos-14
go: stable
hyperscan_version: 5.4.11
pcre_version: 8.45
build_flags: -tags hyperscan_v54,chimera
chimera: true
vectorscan: true
- os: ubuntu-24.04
go: stable
hyperscan_version: 5.4.2
pcre_version: 8.45
build_flags: -tags hyperscan_v54,chimera
chimera: true
coverage: true
- os: ubuntu-22.04
go: stable
hyperscan_version: 5.2.1
pcre_version: 8.45
build_flags: -tags hyperscan_v52,chimera
chimera: true
name: Go ${{ matrix.go }} tests @ ${{ matrix.os }} for hyperscan ${{ matrix.hyperscan_version }}
runs-on: ${{ matrix.os }}
env:
PKG_CONFIG_PATH: ${{ github.workspace }}/dist/lib/pkgconfig
CGO_CFLAGS: -I${{ github.workspace }}/dist/include/hs
CGO_LDFLAGS: -L${{ github.workspace }}/dist/lib
steps:
- uses: actions/checkout@v4
- name: Install Hyperscan ${{ matrix.hyperscan }} with PCRE ${{ matrix.pcre_version }}
uses: flier/install-hyperscan@main
with:
hyperscan_version: ${{ matrix.hyperscan_version }}
pcre_version: ${{ matrix.pcre_version }}
vectorscan: ${{ matrix.vectorscan }}
build_static_lib: on
src_dir: ${{ runner.temp }}/hyperscan/
install_prefix: ${{ github.workspace }}/dist/
cache_key: ${{ runner.os }}-build-hyperscan-${{ matrix.vectorscan }}-${{ matrix.hyperscan_version }}-pcre-${{ matrix.pcre_version }}
- name: Install Golang ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Test Hyperscan API
run: |
go test -v ${{ matrix.build_flags }} ./internal/hs/... ./hyperscan/...
go test -race -v ${{ matrix.build_flags }} ./internal/hs/... ./hyperscan/...
- name: Test Chimera API
if: matrix.chimera
run: |
go test -v ${{ matrix.build_flags }} ./internal/ch/... ./chimera/...
go test -race -v ${{ matrix.build_flags }} ./internal/ch/... ./chimera/...
- name: Run and upload coverage to Codecov
if: matrix.coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
go test -v ${{ matrix.build_flags }} -race -coverprofile=coverage.out -covermode=atomic ./...
bash <(curl -s https://codecov.io/bash)