-
Notifications
You must be signed in to change notification settings - Fork 68
123 lines (107 loc) · 3.58 KB
/
makefile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: 'CI'
on:
push:
branches:
- main
- ipdk_v*
paths:
- 'build/networking/**'
- 'build/networking_ebpf/**'
- 'build/scripts/**'
pull_request:
branches:
- main
- ipdk_v*
paths:
- 'build/networking/**'
- 'build/networking_ebpf/**'
- 'build/scripts/**'
concurrency:
# if workflow for PR or push is already running stop it, and start new one
group: makefile-ci-${{ github.ref }}
cancel-in-progress: true
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: shellcheck
run: make -C build shellcheck
build_containers:
needs: shellcheck
runs-on: ${{ matrix.runner }}
strategy:
matrix:
# for OCI runner change to: runner: [ubuntu-latest, self-hosted]
runner: [ubuntu-latest]
os: [ubuntu2004, fedora33, ebpf-ubuntu2004]
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Set an output parameter `arch` for use in subsequent steps
- name: Get processor architecture
id: system
run: |
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# - name: Login to DockerHub
# if: github.event_name != 'pull_request'
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create tags and labels
id: image_meta
uses: docker/metadata-action@v4
with:
sep-tags: ","
sep-labels: ","
# list of names to use as base name for tags
# add for dockerhub: ipdk-io/ipdk-${{ matrix.os }}-${{ steps.system.outputs.arch }}
images: |
ghcr.io/${{ github.repository_owner }}/ipdk-${{ matrix.os }}-${{ steps.system.outputs.arch }}
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Install IPDK cli
run: |
cd build
./ipdk install ${{ matrix.os }}
ipdk config IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/ipdk-${{ matrix.os }}-${{ steps.system.outputs.arch }}
- name: IPDK image build and push
if: github.event_name != 'pull_request'
run: |
ipdk build --no-cache \
--tags "${{ steps.image_meta.outputs.tags }}" \
--labels "${{ steps.image_meta.outputs.labels }}" \
--push
- name: IPDK image build and export
if: github.event_name == 'pull_request'
run: |
ipdk build --no-cache \
--tags "${{ steps.image_meta.outputs.tags }}" \
--labels "${{ steps.image_meta.outputs.labels }}" \
--export /tmp/${{ matrix.os }}-${{ steps.system.outputs.arch }}.tar
- name: Upload build artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ steps.system.outputs.arch }}
path: /tmp/${{ matrix.os }}-${{ steps.system.outputs.arch }}.tar
retention-days: 1