-
Notifications
You must be signed in to change notification settings - Fork 50
151 lines (133 loc) · 4.61 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Continuous integration
on:
push:
branches:
- master
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
defaults:
run:
shell: bash
jobs:
test:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04, macos-12, macos-11]
go: [stable, 1.20.x, 1.19.x, 1.18.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 hyperscan pkg-config libpcap
- uses: actions/checkout@v3
- name: Install Golang ${{ matrix.go }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: true
- 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-latest
go: stable
hyperscan_version: 5.4.1
pcre_version: 8.45
build_flags: -tags hyperscan_v54,chimera
chimera: true
- os: macos-12
go: stable
hyperscan_version: 5.2.1
pcre_version: 8.45
build_flags: -tags hyperscan_v52,chimera
chimera: true
- os: macos-11
go: stable
hyperscan_version: 5.1.1
pcre_version: 8.45
build_flags: -tags chimera
chimera: true
- os: ubuntu-22.04
go: stable
hyperscan_version: 5.4.1
pcre_version: 8.45
build_flags: -tags hyperscan_v54,chimera
chimera: true
coverage: true
- os: ubuntu-20.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@v3
- 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 }}
build_static_lib: on
src_dir: ${{ runner.temp }}/hyperscan/
install_prefix: ${{ github.workspace }}/dist/
cache_key: ${{ runner.os }}-build-hyperscan-${{ matrix.hyperscan_version }}-pcre-${{ matrix.pcre_version }}
- name: Install Golang ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
cache: true
- 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)
golangci:
name: lint
runs-on: ubuntu-22.04
steps:
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -yq libhyperscan-dev libpcap-dev
- uses: actions/setup-go@v3
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
working-directory: hyperscan