Bump actions/cache from 4.0.2 to 4.1.0 #647
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
name: CI | |
concurrency: ci-${{ github.ref }} | |
on: | |
push: | |
tags-ignore: | |
- "*" | |
branches: | |
- "main" | |
pull_request: | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
PACKAGE_NAME: trento-agent | |
OBS_USER: ${{ secrets.OBS_USER }} | |
OBS_PASS: ${{ secrets.OBS_PASS }} | |
OBS_PROJECT: ${{ secrets.OBS_PROJECT }} | |
TARGET_PROJECT: ${{ secrets.TARGET_PROJECT }} | |
FOLDER: packaging/suse | |
REPOSITORY: ${{ github.repository }} | |
jobs: | |
generate-docs: | |
runs-on: ubuntu-20.04 | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
steps: | |
- name: trigger docs update in sum.golang.org and pkg.go.dev | |
uses: essentialkaos/godoc-action@v1 | |
static-analysis: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
- uses: actions/cache@v4.1.0 | |
id: go-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: go vet check | |
run: make vet-check | |
- name: go fmt check | |
run: make fmt-check | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.59.1 | |
skip-cache: true | |
args: "--timeout=3m" | |
test: | |
runs-on: ubuntu-20.04 | |
env: | |
RABBITMQ_URL: amqp://guest:guest@localhost:5672 | |
services: | |
rabbitmq: | |
image: rabbitmq | |
env: | |
RABBITMQ_DEFAULT_USER: guest | |
RABBITMQ_DEFAULT_PASS: guest | |
ports: | |
- 5672:5672 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
- uses: actions/cache@v4.1.0 | |
id: go-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: test | |
run: make test-coverage | |
- name: install goveralls | |
run: go install github.com/mattn/goveralls@latest | |
- name: send coverage | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: goveralls -coverprofile=covprofile -service=github | |
test-plugins: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
- uses: actions/cache@v4.1.0 | |
id: go-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: build dummy plugin | |
run: | | |
mkdir /tmp/plugins | |
go build -o /tmp/plugins/dummy ./plugin_examples/dummy.go | |
- name: build trento binary | |
run: make build | |
- name: run facts list command | |
run: | | |
./trento-agent facts list --plugins-folder /tmp/plugins 2>&1 | grep -q "dummy" | |
- name: run facts gather command | |
run: | | |
./trento-agent facts gather --gatherer dummy --argument 1 --plugins-folder /tmp/plugins 2>&1 | grep -q 'Name: 1' | |
build-static-binary: | |
runs-on: ubuntu-20.04 | |
needs: [static-analysis, test, test-plugins] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
- uses: actions/cache@v4.1.0 | |
id: go-cache | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: build | |
run: make -j4 cross-compiled | |
- name: compress | |
run: | | |
set -x | |
find ./build -maxdepth 1 -mindepth 1 -type d -exec sh -c 'tar -zcf build/trento-agent-$(basename {}).tgz -C {} trento-agent -C $(pwd)/packaging/systemd trento-agent.service' \; | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: trento-binaries | |
path: | | |
build/trento-agent-amd64.tgz | |
build/trento-agent-arm64.tgz | |
build/trento-agent-ppc64le.tgz | |
build/trento-agent-s390x.tgz | |
release-rolling: | |
needs: [build-static-binary] | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: trento-binaries | |
- uses: "marvinpinto/action-automatic-releases@v1.2.1" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "rolling" | |
prerelease: true | |
title: "Cutting Edge" | |
files: | | |
trento-agent-amd64.tgz | |
trento-agent-arm64.tgz | |
trento-agent-ppc64le.tgz | |
trento-agent-s390x.tgz | |
# This job doesn't actually make release, but rather reacts to a manual one, made via the GitHub UI. | |
# In the future, we might want to reuse the same mechanism of the rolling ones to automate everything here as well. | |
release-tag: | |
needs: [build-static-binary] | |
if: github.event.release | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: trento-binaries | |
- uses: AButler/upload-release-assets@v3.0 | |
with: | |
files: "trento-*" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
obs-commit: | |
needs: [static-analysis, test, test-plugins] | |
runs-on: ubuntu-20.04 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
container: | |
image: ghcr.io/trento-project/continuous-delivery:main | |
env: | |
OSC_CHECKOUT_DIR: /tmp/trento-agent-package | |
options: -u 0:0 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: configure OSC | |
run: | | |
mkdir -p $HOME/.config/osc | |
cp /home/osc/.config/osc/oscrc $HOME/.config/osc | |
/scripts/init_osc_creds.sh | |
- name: prepare _service file | |
run: | | |
git config --global --add safe.directory /__w/agent/agent | |
VERSION=$(./hack/get_version_from_git.sh) | |
sed -i 's~%%REVISION%%~${{ github.sha }}~' $FOLDER/_service && \ | |
sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' $FOLDER/_service && \ | |
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/_service | |
- name: create vendor dependencies archive | |
# note the following tar options to strip all the things that could make the archive different without the content actually changing | |
# to make it easier to identify when dependencies changed | |
run: | | |
go mod vendor | |
tar --sort=name --owner=root:0 --group=root:0 --mtime='UTC 1970-01-01' -c vendor | gzip -n > vendor.tar.gz | |
- name: checkout and prepare OBS package | |
run: | | |
osc checkout $OBS_PROJECT trento-agent -o $OSC_CHECKOUT_DIR | |
cp $FOLDER/_service $OSC_CHECKOUT_DIR | |
rm -v $OSC_CHECKOUT_DIR/*.tar.gz | |
pushd $OSC_CHECKOUT_DIR | |
osc service manualrun | |
cp /__w/agent/agent/vendor.tar.gz . | |
- name: prepare trento-agent.changes file | |
# The .changes file is updated only in release creation. This current task should be improved | |
# in order to add the current rolling release notes | |
if: github.event_name == 'release' | |
run: | | |
git config --global --add safe.directory /__w/agent/agent | |
VERSION=$(./hack/get_version_from_git.sh) | |
TAG=$(echo $VERSION | cut -f1 -d+) | |
hack/gh_release_to_obs_changeset.py $REPOSITORY -a shap-staff@suse.de -t $TAG -f $OSC_CHECKOUT_DIR/trento-agent.changes | |
- name: commit changes into OBS | |
run: | | |
pushd $OSC_CHECKOUT_DIR | |
osc ar | |
osc commit -m "GitHub Actions automated update to reference ${{ github.sha }}" | |
obs-submit: | |
needs: obs-commit | |
runs-on: ubuntu-20.04 | |
if: github.event.release | |
container: | |
image: ghcr.io/trento-project/continuous-delivery:main | |
options: -u 0:0 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: configure OSC | |
run: | | |
mkdir -p $HOME/.config/osc | |
cp /home/osc/.config/osc/oscrc $HOME/.config/osc | |
/scripts/init_osc_creds.sh | |
- name: prepare _service file | |
run: | | |
git config --global --add safe.directory /__w/agent/agent | |
VERSION=$(./hack/get_version_from_git.sh) | |
sed -i 's~%%REVISION%%~${{ github.sha }}~' $FOLDER/_service && \ | |
sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' $FOLDER/_service && \ | |
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/_service | |
- name: submit package | |
run: /scripts/submit.sh |