Graceful restart for l3afd #1763
Workflow file for this run
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
# Copyright Contributors to the L3AF Project. | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
# For documentation on the github environment, see | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners | |
# | |
# For documentation on the syntax of this file, see | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
name: CI Ubuntu build | |
on: | |
pull_request: {} | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Setup Go 1.22.3 | |
uses: actions/setup-go@b26d40294f8ad76fcc90b915dac85892322fe62d | |
with: | |
go-version: '1.22.3' | |
- name: Harden Runner | |
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- name: Set up environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc libc-dev bash perl curl make docker docker.io | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
- name: Format | |
run: | | |
go install golang.org/x/tools/cmd/goimports@latest | |
res="$(goimports -l .)" | |
if [[ "$(printf '%s' "$res")" != '' ]]; then | |
echo "Unformatted source code:" | |
echo "$res" | |
exit 1 | |
fi | |
- name: Vet | |
run: | | |
go vet ./... | |
- name: Test | |
run: | | |
go test ./... | |
go clean -modcache | |
- uses: dominikh/staticcheck-action@fe1dd0c3658873b46f8c9bb3291096a617310ca6 | |
with: | |
version: "2024.1.1" | |
install-go: false | |
cache-key: "1.22.x" | |
- name: Build | |
run: | | |
make | |
- name: Copy files | |
if: github.ref == 'refs/heads/main' | |
run: | | |
sudo cp ./config/l3afd.cfg ./build-docker | |
sudo cp l3afd ./build-docker | |
- name: login to docker registry | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
with: | |
username: ${{secrets.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKER_TOKEN}} | |
- name: build and push docker image to registry | |
if: github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 | |
with: | |
context: ./build-docker | |
push: true | |
tags: linuxfoundationl3af/l3afd:latest | |
- name: upload l3afd binary | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 | |
with: | |
name: l3afd-latest-linux-x86_64 | |
path: l3afd | |