Skip to content

Commit

Permalink
try composite actions
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
  • Loading branch information
Andreagit97 committed Jul 14, 2024
1 parent 411a1ec commit dd8e046
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
15 changes: 15 additions & 0 deletions .github/actions/setup-env/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Setup Environment"
description: "Installs dependencies and go code"
runs:
using: "composite"
steps:
- name: Install deps
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends build-essential git clang llvm libelf-dev libbpf-dev
- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: "go.mod"
check-latest: true
38 changes: 20 additions & 18 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
name: Build and test

on:
pull_request:
push:
branches:
- main

jobs:
build_and_test:
runs-on: ubuntu-24.04
steps:
- name: Install deps
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends build-essential git clang llvm libelf-dev libbpf-dev
- name: Checkout commit
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
check-latest: true
- name: Setup Environment
uses: ./.github/actions/setup-env

- name: Build
run: |
Expand All @@ -34,30 +24,42 @@ jobs:
- name: Run tests
run: |
sudo -E env "PATH=$PATH" go test ./... -count=1
# use goreleaser to build all supported archs
upload_dev_artifacts:
needs: build_and_test
runs-on: ubuntu-24.04
steps:
- name: Checkout commit
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Setup Environment
uses: ./.github/actions/setup-env

# use goreleaser to build all supported archs
- name: Build all supported archs
id: run-goreleaser
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
with:
distribution: goreleaser
version: latest
args: release --snapshot --clean

- name: Archive x86_64 tar.gz
uses: actions/upload-artifact@v3
with:
name: x86_64
path: ./dist/bpftree_Linux_x86_64.tar.gz
path: ./dist/bpftree_Linux_x86_64.tar.gz

- name: Archive arm64 tar.gz
uses: actions/upload-artifact@v3
with:
name: arm64
path: ./dist/bpftree_Linux_arm64.tar.gz
path: ./dist/bpftree_Linux_arm64.tar.gz

- name: Archive s390x tar.gz
uses: actions/upload-artifact@v3
with:
name: s390x
path: ./dist/bpftree_Linux_s390x.tar.gz
path: ./dist/bpftree_Linux_s390x.tar.gz

0 comments on commit dd8e046

Please sign in to comment.