Merge ipdk v23.07 branch to main #694
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' | |
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 |