Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,60 @@ jobs:
fail-fast: false
matrix:
go-version: [1.15.x, 1.16.x, 1.17.x]
libseccomp: ["v2.3.3", "v2.4.3", "v2.5.2", "HEAD"]

steps:

- name: checkout
uses: actions/checkout@v2

- name: install deps
run: |
sudo apt -q update
sudo apt -q install libseccomp-dev

- name: install go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
stable: '!contains(${{ matrix.go-version }}, "beta") && !contains(${{ matrix.go-version }}, "rc")'
go-version: ${{ matrix.go-version }}

- name: build libseccomp ${{ matrix.libseccomp }}
run: |
set -x
sudo apt -qq update
sudo apt -qq install gperf

PREFIX="$(pwd)/seccomp"
LIBDIR="$PREFIX/lib"

git clone https://github.com/seccomp/libseccomp
cd libseccomp
git checkout ${{ matrix.libseccomp }}
# In main branch, configure.ac sets libseccomp version to 0.0.0, which
# results in error when compiling libseccomp-golang. While 0.0.0 is
# there for a reason, here we need to build and test against HEAD, so
# set it to a suitable value.
#
# Version 9.9.9 is used because:
# - version >= current is needed;
# - chances are good such version won't ever exist;
# - it is easy to spot in tests output;
# - the LIBFILE pattern below expects single digits.
VER="${{ matrix.libseccomp }}"
if [ "$VER" == "HEAD" ]; then
VER=9.9.9
sed -i "/^AC_INIT(/s/0\.0\.0/$VER/" configure.ac
fi
./autogen.sh
./configure --prefix="$PREFIX" --libdir="$LIBDIR"
make
sudo make install
cd -
rm -rf libseccomp

# For the next steps to build and execute with the compiled library.
echo "PKG_CONFIG_LIBDIR=$LIBDIR/pkgconfig" >> $GITHUB_ENV
LIBFILE="$(echo $LIBDIR/libseccomp.so.?.?.?)"
echo "LD_PRELOAD=$LIBFILE" >> $GITHUB_ENV
# For TestExpectedSeccompVersion.
echo "_EXPECTED_LIBSECCOMP_VERSION=$VER" >> $GITHUB_ENV

- name: build
run: make check-build

Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ jobs:
# must be specified without patch version
version: v1.41


codespell:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: install deps
# Version of codespell bundled with Ubuntu is way old, so use pip.
run: pip install codespell
- name: run codespell
run: codespell
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# For documentation, see https://golangci-lint.run/usage/configuration/
linters:
enable:
- gofumpt
26 changes: 9 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
How to Submit Patches to the libseccomp Project
How to Submit Patches to the libseccomp-golang Project
===============================================================================
https://github.com/seccomp/libseccomp-golang

This document is intended to act as a guide to help you contribute to the
libseccomp project. It is not perfect, and there will always be exceptions
to the rules described here, but by following the instructions below you
should have a much easier time getting your work merged with the upstream
libseccomp-golang project. It is not perfect, and there will always be
exceptions to the rules described here, but by following the instructions below
you should have a much easier time getting your work merged with the upstream
project.

## Test Your Code Using Existing Tests

There are two possible tests you can run to verify your code. The first
test is used to check the formatting and coding style of your changes, you
can run the test with the following command:

# make check-syntax

... if there are any problems with your changes a diff/patch will be shown
which indicates the problems and how to fix them.

The second possible test is used to ensure the sanity of your code changes
and to test these changes against the included tests. You can run the test
with the following command:
A number of tests and lint related recipes are provided in the Makefile, if
you want to run the standard regression tests, you can execute the following:

# make check

... if there are any faults or errors they will be displayed.
In order to use it, the 'golangci-lint' tool is needed, which can be found at:

* https://github.com/golangci/golangci-lint

## Add New Tests for New Functionality

Expand Down
23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
===============================================================================
https://github.com/seccomp/libseccomp-golang

[![Build Status](https://img.shields.io/travis/seccomp/libseccomp-golang/main.svg)](https://travis-ci.org/seccomp/libseccomp-golang)
[![Go Reference](https://pkg.go.dev/badge/github.com/seccomp/libseccomp-golang.svg)](https://pkg.go.dev/github.com/seccomp/libseccomp-golang)
[![validate](https://github.com/seccomp/libseccomp-golang/actions/workflows/validate.yml/badge.svg)](https://github.com/seccomp/libseccomp-golang/actions/workflows/validate.yml)
[![test](https://github.com/seccomp/libseccomp-golang/actions/workflows/test.yml/badge.svg)](https://github.com/seccomp/libseccomp-golang/actions/workflows/test.yml)

The libseccomp library provides an easy to use, platform independent, interface
to the Linux Kernel's syscall filtering mechanism. The libseccomp API is
Expand All @@ -26,25 +28,14 @@ list.

* https://groups.google.com/d/forum/libseccomp

Documentation is also available at:
Documentation for this package is also available at:

* https://godoc.org/github.com/seccomp/libseccomp-golang
* https://pkg.go.dev/github.com/seccomp/libseccomp-golang

## Installing the package

The libseccomp-golang bindings require at least Go v1.2.1 and GCC v4.8.4;
earlier versions may yield unpredictable results. If you meet these
requirements you can install this package using the command below:

# go get github.com/seccomp/libseccomp-golang

## Testing the Library

A number of tests and lint related recipes are provided in the Makefile, if
you want to run the standard regression tests, you can excute the following:

# make check

In order to use it, the 'golangci-lint' tool is needed, which can be found at:
## Contributing

* https://github.com/golangci/golangci-lint
See [CONTRIBUTING.md](CONTRIBUTING.md).
23 changes: 0 additions & 23 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7 h1:EBZoQjiKKPaLbPrbpssUfuHtwM6KV/vb4U85g/cigFY=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200313205530-4303120df7d8 h1:gkI/wGGwpcG5W4hLCzZNGxA4wzWBGGDStRI1MrjDl2Q=
golang.org/x/tools v0.0.0-20200313205530-4303120df7d8/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Loading