Skip to content

Commit

Permalink
refactor CI folders structure and support daily build (#924)
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Yuan <[email protected]>
  • Loading branch information
SamYuan1990 authored Sep 17, 2023
1 parent c519bcf commit e75ba5d
Show file tree
Hide file tree
Showing 22 changed files with 190 additions and 215 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Scheduled build
on:
branch_protection_rule:
schedule:
- cron: "12 9 * * *"

jobs:
# daily go security
gosec:
uses: ./.github/workflows/gosec.yml
# daily image build
image:
uses: ./.github/workflows/image.yml
# daily openSSF scan
scorecard:
uses: ./.github/workflows/scorecard.yml
33 changes: 33 additions & 0 deletions .github/workflows/developer_local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: local dev env validation
# for developer local environment script or test usage
on:
workflow_call:

jobs:
unit_test_mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Prepare environment
run: |
brew install cpuid
cd doc/ && sudo ./dev/prepare_dev_env.sh && cd -
git config --global --add safe.directory /kepler
- name: Run
run: make test-mac-verbose

local_env:
runs-on: ubuntu-latest
strategy:
matrix:
kube_provider: [kind]
steps:
- uses: actions/checkout@v4
- name: local cluster set up
run: make cluster-up
19 changes: 0 additions & 19 deletions .github/workflows/gofmt.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/gogc.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/golang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: golang
# for golang basic checks with go command line tool
on:
workflow_call:

permissions:
contents: read

jobs:
gofmt_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: run gofmt test
run: ./automation/presubmit-tests/gofmt.sh

escapes_detect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: run escapes detect
run: make escapes_detect

golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2

govet_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v2
with:
go-version-file: go.mod
- name: Run go vet
run: go vet ./...

vulnerability_detect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: run vulnerability detect
run: make govulncheck
24 changes: 0 additions & 24 deletions .github/workflows/golangci-lint.yml

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: Security Scan
# Run workflow each time code is pushed to your repository and on a schedule.
# The scheduled workflow runs every at 00:00 on Sunday UTC time.
on:
push:
schedule:
- cron: '0 0 * * 0'
workflow_call:

jobs:
tests:
Expand All @@ -14,7 +12,7 @@ jobs:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Run Gosec Security Scanner
uses: securego/gosec@master
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/govet.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/govulnerability.yml

This file was deleted.

9 changes: 2 additions & 7 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
name: image

on:
push:
branches: [ main ]
paths-ignore:
- 'doc/**'
- 'enhancements/**'
- '*.md'
workflow_call:

jobs:
image_build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/image_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commitSHA }}
- name: Set up QEMU
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
name: Integration test

on:
pull_request:
paths-ignore:
- 'doc/**'
- 'enhancements/**'
- '*.md'
workflow_call:

env:
GO_VERSION: "1.18"
OUTPUT_DIR: "_output/"
FILE_NAME: "kepler.tar.gz"
ARTIFACT_DIR: "/tmp/artifacts"

jobs:
build-kepler:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: install Go
uses: actions/setup-go@v3
with:
go-version: ${{env.GO_VERSION}}
go-version-file: go.mod

- name: build and export Kepler image
run: |
Expand All @@ -47,13 +42,13 @@ jobs:

integration_test:
needs: [build-kepler]
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
cluster_provider: [kind,microshift]
steps:
- name: checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: download Kepler image artifact
uses: actions/download-artifact@v3
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/integration_test_libbpf.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
name: Integration test with libbpf

on:
pull_request:
paths-ignore:
- 'doc/**'
- 'enhancements/**'
- '*.md'
workflow_call:

env:
GO_VERSION: "1.18"
OUTPUT_DIR: "_output/"
FILE_NAME: "kepler_libbpf.tar.gz"
ARTIFACT_DIR: "/tmp/artifacts"

jobs:
build-kepler_with_libbpf:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: install Go
uses: actions/setup-go@v3
with:
go-version: ${{env.GO_VERSION}}
go-version-file: go.mod

- name: build and export Kepler image
run: |
Expand All @@ -48,13 +43,13 @@ jobs:

integration_test_with_libbpf:
needs: [build-kepler_with_libbpf]
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
cluster_provider: [kind,microshift]
steps:
- name: checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: download Kepler image artifact
uses: actions/download-artifact@v3
Expand Down
Loading

0 comments on commit e75ba5d

Please sign in to comment.