-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from flier/feature/upgrade_golang
upgrade golang
- Loading branch information
Showing
50 changed files
with
628 additions
and
985 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- "**.md" | ||
pull_request: | ||
paths-ignore: | ||
- "**.md" | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- ubuntu_version: 22.04 | ||
hyperscan_version: 5.4.1 | ||
pcre_version: 8.45 | ||
go_version: 1.20.3 | ||
build_flags: -tags hyperscan_v54,chimera | ||
- ubuntu_version: 20.04 | ||
hyperscan_version: 5.2.1 | ||
pcre_version: 8.45 | ||
go_version: 1.19.8 | ||
build_flags: -tags hyperscan_v52,chimera | ||
- ubuntu_version: 20.04 | ||
hyperscan_version: 5.1.1 | ||
pcre_version: 8.45 | ||
build_flags: -tags chimera | ||
go_version: 1.18.10 | ||
- ubuntu_version: 18.04 | ||
hyperscan_version: 4.7.0 | ||
pcre_version: 8.42 | ||
go_version: 1.18.10 | ||
build_flags: -tags hyperscan_v4 | ||
name: tests @ ubuntu ${{ matrix.ubuntu_version }} for hyperscan ${{ matrix.hyperscan_version }} w/ ${{ matrix.build_flags }} | ||
env: | ||
LATEST_TAG: flier/gohs:${{ matrix.hyperscan_version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
load: true | ||
build-args: | | ||
UBUNTU_VERSION=${{ matrix.ubuntu_version }} | ||
HYPERSCAN_VERSION=${{ matrix.hyperscan_version }} | ||
PCRE_VERSION=${{ matrix.pcre_version }} | ||
GO_VERSION=${{ matrix.go_version }} | ||
tags: ${{ env.LATEST_TAG }} | ||
|
||
- name: Test | ||
run: | | ||
docker run --rm ${{ env.LATEST_TAG }} test ${{ matrix.build_flags }} -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,116 @@ | ||
ARG UBUNTU_VERSION=20.04 | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM ubuntu:${UBUNTU_VERSION} | ||
ARG UBUNTU_VERSION=22.04 | ||
|
||
ARG GO_VERSION=1.17.1 | ||
ARG HYPERSCAN_VERSION=5.4.0 | ||
ARG PCRE_VERSION=8.45 | ||
FROM ubuntu:${UBUNTU_VERSION} as build | ||
|
||
# Install dependencies | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
libboost-dev \ | ||
libbz2-dev \ | ||
libpcap-dev \ | ||
ninja-build \ | ||
pkg-config \ | ||
python2.7 \ | ||
ragel \ | ||
wget \ | ||
zlib1g-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install golang | ||
|
||
RUN wget https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -O /go${GO_VERSION}.tar.gz && \ | ||
rm -rf /usr/local/go && \ | ||
tar -C /usr/local -xzf /go${GO_VERSION}.tar.gz && \ | ||
rm /go${GO_VERSION}.tar.gz | ||
|
||
ENV PATH=/usr/local/go/bin:${PATH} | ||
# hadolint ignore=DL3008 | ||
RUN <<EOT bash | ||
apt-get update | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
libboost-dev \ | ||
libbz2-dev \ | ||
libpcap-dev \ | ||
ninja-build \ | ||
pkg-config \ | ||
python2.7 \ | ||
ragel \ | ||
wget \ | ||
zlib1g-dev | ||
rm -rf /var/lib/apt/lists/* | ||
EOT | ||
|
||
# Download Hyperscan | ||
|
||
ARG HYPERSCAN_VERSION=5.4.1 | ||
|
||
ENV HYPERSCAN_DIR=/hyperscan | ||
|
||
RUN wget https://github.com/intel/hyperscan/archive/refs/tags/v${HYPERSCAN_VERSION}.tar.gz -O /hyperscan-${HYPERSCAN_VERSION}.tar.gz && \ | ||
mkdir ${HYPERSCAN_DIR} && tar xf /hyperscan-${HYPERSCAN_VERSION}.tar.gz -C ${HYPERSCAN_DIR} --strip-components=1 && rm /hyperscan-${HYPERSCAN_VERSION}.tar.gz | ||
RUN wget https://sourceforge.net/projects/pcre/files/pcre/${PCRE_VERSION}/pcre-${PCRE_VERSION}.tar.gz/download -O /pcre-${PCRE_VERSION}.tar.gz && \ | ||
mkdir ${HYPERSCAN_DIR}/pcre && tar xf /pcre-${PCRE_VERSION}.tar.gz -C ${HYPERSCAN_DIR}/pcre --strip-components=1 && rm /pcre-${PCRE_VERSION}.tar.gz | ||
WORKDIR ${HYPERSCAN_DIR} | ||
|
||
ADD https://github.com/intel/hyperscan/archive/refs/tags/v${HYPERSCAN_VERSION}.tar.gz /hyperscan-v${HYPERSCAN_VERSION}.tar.gz | ||
RUN <<EOT bash | ||
tar xf /hyperscan-v${HYPERSCAN_VERSION}.tar.gz -C ${HYPERSCAN_DIR} --strip-components=1 | ||
rm /hyperscan-v${HYPERSCAN_VERSION}.tar.gz | ||
EOT | ||
|
||
ARG PCRE_VERSION=8.45 | ||
|
||
ADD https://sourceforge.net/projects/pcre/files/pcre/${PCRE_VERSION}/pcre-${PCRE_VERSION}.tar.gz/download /pcre-${PCRE_VERSION}.tar.gz | ||
|
||
WORKDIR ${HYPERSCAN_DIR}/pcre | ||
|
||
RUN <<EOT bash | ||
tar xf /pcre-${PCRE_VERSION}.tar.gz -C ${HYPERSCAN_DIR}/pcre --strip-components=1 | ||
rm /pcre-${PCRE_VERSION}.tar.gz | ||
EOT | ||
|
||
# Install Hyperscan | ||
|
||
ENV INSTALL_DIR=/usr/local | ||
ENV INSTALL_DIR=/dist | ||
|
||
WORKDIR ${HYPERSCAN_DIR}/build | ||
|
||
ARG CMAKE_BUILD_TYPE=RelWithDebInfo | ||
|
||
RUN <<EOT bash | ||
cmake -G Ninja \ | ||
-DBUILD_STATIC_LIBS=ON \ | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ | ||
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ | ||
.. | ||
ninja | ||
ninja install | ||
mv ${HYPERSCAN_DIR}/build/lib/lib*.a ${INSTALL_DIR}/lib/ | ||
EOT | ||
|
||
FROM ubuntu:${UBUNTU_VERSION} | ||
|
||
# Install dependencies | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# hadolint ignore=DL3008 | ||
RUN <<EOT bash | ||
apt-get update | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
libpcap-dev \ | ||
pkg-config | ||
rm -rf /var/lib/apt/lists/* | ||
EOT | ||
|
||
# Install golang | ||
|
||
ARG GO_VERSION=1.20.3 | ||
|
||
ADD https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz / | ||
|
||
RUN <<EOT bash | ||
tar -C /usr/local -xzf /go${GO_VERSION}.linux-amd64.tar.gz | ||
rm /go${GO_VERSION}.linux-amd64.tar.gz | ||
EOT | ||
|
||
ENV PATH="/usr/local/go/bin:${PATH}" | ||
|
||
ENV INSTALL_DIR=/dist | ||
|
||
RUN mkdir ${HYPERSCAN_DIR}/build && cd ${HYPERSCAN_DIR}/build && \ | ||
cmake -G Ninja -DBUILD_STATIC_LIBS=on -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ${HYPERSCAN_DIR} && \ | ||
ninja && ninja install && mv ${HYPERSCAN_DIR}/build/lib/lib*.a ${INSTALL_DIR}/lib/ && cd / && rm -rf ${HYPERSCAN_DIR} | ||
COPY --from=build ${INSTALL_DIR} ${INSTALL_DIR} | ||
|
||
ENV PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig | ||
ENV PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${INSTALL_DIR}/lib/pkgconfig" | ||
|
||
# Add gohs code | ||
|
||
ADD . /gohs/ | ||
COPY . /gohs/ | ||
|
||
WORKDIR /gohs | ||
ENTRYPOINT ["/usr/local/go/bin/go"] | ||
CMD ["test", "./..."] | ||
CMD ["test", "-v", "./..."] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
module github.com/flier/gohs | ||
|
||
go 1.15 | ||
go 1.18 | ||
|
||
require ( | ||
github.com/google/gopacket v1.1.19 | ||
github.com/smartystreets/goconvey v1.8.0 | ||
) | ||
|
||
require ( | ||
github.com/gopherjs/gopherjs v1.17.2 // indirect | ||
github.com/jtolds/gls v4.20.0+incompatible // indirect | ||
github.com/smartystreets/assertions v1.13.0 // indirect | ||
github.com/smartystreets/goconvey v1.7.2 | ||
golang.org/x/net v0.4.0 // indirect | ||
golang.org/x/sys v0.3.0 // indirect | ||
github.com/smartystreets/assertions v1.13.1 // indirect | ||
golang.org/x/net v0.9.0 // indirect | ||
golang.org/x/sys v0.7.0 // indirect | ||
) |
Oops, something went wrong.