-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GH Actions + Refactors #48
Merged
moshe010
merged 7 commits into
k8snetworkplumbingwg:master
from
adrianchiris:add-gh-actions
May 30, 2023
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e032b79
Remove old travis file
adrianchiris e3b04e4
Makefile refactors
adrianchiris f20ed1e
Add and update Dockerfiles
adrianchiris 20fd927
Bump go to 1.20
adrianchiris 7dce561
Add github action workflows
adrianchiris ac33464
Fix hadolint/shellcheck issues
adrianchiris 2148e8b
use ubuntu-22.04 in workflows
adrianchiris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: go-build-and-test-amd64 | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: "0 8 * * 0" # every sunday | ||
jobs: | ||
build: | ||
name: build | ||
strategy: | ||
matrix: | ||
go-version: [1.20.x] | ||
os: [ubuntu-latest] | ||
goos: [linux] | ||
goarch: [amd64] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: build test for ${{ matrix.goarch }} | ||
env: | ||
GOARCH: ${{ matrix.goarch }} | ||
GOOS: ${{ matrix.goos }} | ||
run: make build | ||
|
||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.20.x | ||
- name: check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
- name: run unit-test | ||
run: make test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
schedule: | ||
- cron: "37 4 * * 0" | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ go ] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
queries: +security-and-quality | ||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:${{ matrix.language }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: "push images on merge to master" | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/${{ github.repository }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
build-and-push-amd64-rdma-cni: | ||
name: image push amd64 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: login to Docker | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: build and push rdma-cni | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/amd64 | ||
tags: | | ||
${{ env.IMAGE_NAME }}:latest-amd64 | ||
${{ steps.docker_meta.outputs.tags }}:${{ github.sha }} | ||
file: ./Dockerfile | ||
|
||
build-and-push-arm64-rdma-cni: | ||
name: image push arm64 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: login to Docker | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: build and push rdma-cni | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/arm64 | ||
tags: | | ||
${{ env.IMAGE_NAME }}:latest-arm64 | ||
file: ./Dockerfile.arm64 | ||
|
||
build-and-push-ppc64le-rdma-cni: | ||
name: image Push ppc64le | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: login to Docker | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: build and push rdma-cni | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/ppc64le | ||
tags: | | ||
${{ env.IMAGE_NAME }}:latest-ppc64le | ||
file: ./Dockerfile.ppc64le | ||
|
||
push-manifest: | ||
runs-on: ubuntu-20.04 | ||
needs: [build-and-push-amd64-rdma-cni,build-and-push-amr64-rdma-cni,build-and-push-ppc64le-rdma-cni] | ||
steps: | ||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create manifest for multi-arch images | ||
run: | | ||
# pull | ||
docker pull ${{ env.IMAGE_NAME }}:latest-amd64 | ||
docker pull ${{ env.IMAGE_NAME }}:latest-arm64 | ||
docker pull ${{ env.IMAGE_NAME }}:latest-ppc64le | ||
# create | ||
docker manifest create ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-amd64 ${{ env.IMAGE_NAME }}:latest-arm64 ${{ env.IMAGE_NAME }}:latest-ppc64le | ||
# annotate | ||
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-amd64 --arch amd64 | ||
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-arm64 --arch arm64 | ||
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-ppc64le --arch ppc64le | ||
# push | ||
docker manifest push ${{ env.IMAGE_NAME }}:latest |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
name: "push images on release" | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/${{ github.repository }} | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
jobs: | ||
build-and-push-amd64-rdma-cni: | ||
runs-on: ubuntu-20.04 | ||
name: image push AMD64 | ||
steps: | ||
- name: check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: login to Docker | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: docker meta | ||
id: docker_meta | ||
uses: crazy-max/ghaction-docker-meta@v1 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
tag-latest: false | ||
|
||
- name: build and push rdma-cni | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/amd64 | ||
tags: | | ||
${{ steps.docker_meta.outputs.tags }}-amd64 | ||
${{ steps.docker_meta.outputs.tags }}:${{ github.sha }} | ||
file: ./Dockerfile | ||
|
||
build-and-push-arm64-rdma-cni: | ||
runs-on: ubuntu-20.04 | ||
name: image push ARM64 | ||
steps: | ||
- name: check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: login to Docker | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: docker meta | ||
id: docker_meta | ||
uses: crazy-max/ghaction-docker-meta@v1 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
tag-latest: false | ||
|
||
- name: build and push rdma-cni | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/arm64 | ||
tags: | | ||
${{ steps.docker_meta.outputs.tags }}-arm64 | ||
file: ./Dockerfile.arm64 | ||
|
||
build-and-push-ppc64le-rdma-cni: | ||
runs-on: ubuntu-20.04 | ||
name: image push ppc64le | ||
steps: | ||
- name: check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: login to Docker | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: docker meta | ||
id: docker_meta | ||
uses: crazy-max/ghaction-docker-meta@v1 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
tag-latest: false | ||
|
||
- name: build and push rdma-cni | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/arm64 | ||
tags: | | ||
${{ steps.docker_meta.outputs.tags }}-ppc64le | ||
file: ./Dockerfile.ppc64le | ||
|
||
push-manifest: | ||
runs-on: ubuntu-20.04 | ||
needs: [build-and-push-amd64-rdma-cni,build-and-push-amr64-rdma-cni,build-and-push-ppc64le-rdma-cni] | ||
steps: | ||
- name: set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: docker meta | ||
id: docker_meta | ||
uses: crazy-max/ghaction-docker-meta@v1 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
tag-latest: false | ||
|
||
- name: login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: create manifest for multi-arch images | ||
run: | | ||
# pull | ||
docker pull ${{ steps.docker_meta.outputs.tags }}-amd64 | ||
docker pull ${{ steps.docker_meta.outputs.tags }}-arm64 | ||
docker pull ${{ steps.docker_meta.outputs.tags }}-ppc64le | ||
# create | ||
docker manifest create ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64 ${{ steps.docker_meta.outputs.tags }}-arm64 ${{ steps.docker_meta.outputs.tags }}-ppc64le | ||
# annotate | ||
docker manifest annotate ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64 --arch amd64 | ||
docker manifest annotate ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-arm64 --arch arm64 | ||
docker manifest annotate ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-ppc64le --arch ppc64le | ||
# push | ||
docker manifest push ${{ steps.docker_meta.outputs.tags }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: go-static-analysis | ||
on: [push, pull_request] | ||
jobs: | ||
golangci: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.20" | ||
- name: checkout PR | ||
uses: actions/checkout@v2 | ||
- name: run make lint | ||
run: make lint | ||
shellcheck: | ||
name: shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout PR | ||
uses: actions/checkout@v2 | ||
- name: run ShellCheck | ||
uses: ludeeus/action-shellcheck@master | ||
hadolint: | ||
runs-on: ubuntu-latest | ||
name: Hadolint | ||
steps: | ||
- name: checkout PR | ||
uses: actions/checkout@v2 | ||
- name: run Hadolint | ||
uses: brpaz/[email protected] | ||
with: | ||
dockerfile: Dockerfile |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why not to use ubuntu-latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
essentially copied either from sriov-cni or sriov-device-plugin.
maybe for stability ? so u know what u get when building image.
that said. i can change to latest if u think it better :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it good to pin it, what go me confused is that the build and test are on ubunut-latest.
Maybe we should move all to ubuntu-22.04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack. will pin all and move to 22.04.