Merge pull request #71 from AkihiroSuda/dependabot/github_actions/act… #163
This file contains hidden or 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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
- 'release/**' | |
pull_request: | |
jobs: | |
main: | |
env: | |
GOTOOLCHAIN: local | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runner: ubuntu-24.04 # Intel | |
go: 1.25.x | |
build_mode: "" | |
- runner: ubuntu-24.04 # Intel | |
go: 1.25.x | |
build_mode: "strip" | |
- runner: macos-13 # Intel | |
go: 1.25.x | |
build_mode: "" | |
- runner: macos-15 # ARM | |
# libgomodjail_hook_darwin is sensitive to Go version | |
go: 1.24.x | |
build_mode: "" | |
- runner: macos-15 # ARM | |
go: 1.25.x | |
build_mode: "" | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Install | |
run: | | |
set -eux | |
make | |
sudo make install | |
- name: Unit tests | |
run: go test -v ./... | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v8 | |
- name: Smoke test | |
timeout-minutes: 5 | |
env: | |
BUILD_MODE: ${{ matrix.build_mode }} | |
run: | | |
set -eux | |
cd examples/victim | |
if [ "${BUILD_MODE}" = "strip" ]; then | |
go build -ldflags="-s -w" | |
else | |
go build | |
fi | |
# Unpacked mode | |
gomodjail run --go-mod=go.mod -- ./victim | |
# Packed mode | |
gomodjail pack --go-mod=go.mod ./victim | |
./victim.gomodjail | |
if [ "$(find /tmp -maxdepth 1 -type d -name 'gomodjail*' | awk 'END{print NR}')" != "0" ]; then | |
echo >&2 "tmp files are leaked" | |
exit 1 | |
fi | |
- name: "Smoke test: docker (not dockerd)" | |
if: runner.os == 'Linux' | |
timeout-minutes: 5 | |
run: | | |
set -eux | |
DOCKER="gomodjail run --go-mod=./examples/profiles/docker.mod -- docker" | |
$DOCKER buildx create --name foo --use | |
cat <<EOF | $DOCKER buildx build -t foo --load - | |
FROM alpine | |
RUN apk add bash | |
EOF | |
$DOCKER run --rm foo /bin/bash -c "echo hi" |