lazydocker/.github/workflows/ci.yml
christophe-duc 959af52e37 updated
2026-01-08 19:59:22 -04:00

150 lines
No EOL
4.1 KiB
YAML

name: Continuous Integration
env:
GO_VERSION: '1.25'
on:
push:
branches:
- master
pull_request:
jobs:
ci:
name: ci - ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Cache build
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-test
restore-keys: |
${{runner.os}}-go-
- name: Test code
run: |
bash ./test.sh
integration:
name: integration-tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Cache build
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-integration
restore-keys: |
${{runner.os}}-go-
- name: Install Podman
run: |
sudo apt-get update
sudo apt-get install -y podman
- name: Start Podman socket
run: |
systemctl --user start podman.socket
podman info
- name: Run integration tests
run: |
go test -tags=integration,containers_image_openpgp,exclude_graphdriver_btrfs -v ./pkg/commands/...
build:
runs-on: ubuntu-latest
env:
GOARCH: amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Cache build
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-build
restore-keys: |
${{runner.os}}-go-
- name: Build linux binary
run: |
GOOS=linux go build -tags=containers_image_openpgp,exclude_graphdriver_btrfs
- name: Build darwin binary
run: |
GOOS=darwin go build -tags=containers_image_openpgp,exclude_graphdriver_btrfs
check-codebase:
runs-on: ubuntu-latest
env:
GOARCH: amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Cache build
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-build
restore-keys: |
${{runner.os}}-go-
- name: Check Cheatsheet
run: |
go run -tags=containers_image_openpgp,exclude_graphdriver_btrfs scripts/cheatsheet/main.go check
- name: Check go.mod is tidy
run: |
go mod tidy && git diff --exit-code go.mod go.sum || (echo "go.mod/go.sum not tidy. Run 'go mod tidy' locally and commit the changes" && exit 1)
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Cache build
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}-test
restore-keys: |
${{runner.os}}-go-
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --build-tags=containers_image_openpgp,exclude_graphdriver_btrfs --timeout=15m
skip-cache: true
- name: Format code
run: |
if [ $(find . -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then
find . -name "*.go" -exec gofmt -s -d {} \;
exit 1
fi