Skip to content
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

🌱 [backport] Workflow pipeline with unit tests #1772

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions .github/workflows/e2e-fixture-test.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
name: E2E Fixture Test

on:
pull_request:
branches:
- 'main'
- 'release-*'
paths-ignore:
- '**/*.md'
- 'docs/**'
- '.gitignore'
- 'hack/*.sh'
- 'LICENSE'
- 'SECURITY_CONTACTS'
- 'DCO'
- 'OWNERS'
workflow_call:

permissions: {}

jobs:
test:
name: e2e test
name: E2E fixture test
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

Expand All @@ -39,3 +24,11 @@ jobs:
USE_EXISTING_CLUSTER: "false"
GINKGO_NODES: 1
run: make test-e2e

- name: Upload artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: artifacts-fixture.tar.gz
path: test/e2e/_artifacts
if-no-files-found: error
overwrite: false
32 changes: 0 additions & 32 deletions .github/workflows/e2e-test-pull.yaml

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ permissions: {}

jobs:
test:
name: e2e test
name: E2E test
runs-on: ${{ inputs.runner }}

permissions:
contents: read

steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: golangci-lint

on:
pull_request:
types: [opened, edited, synchronize, reopened]
workflow_call:

# Remove all permissions from GITHUB_TOKEN except metadata.
permissions: {}
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: E2E Test pipeline

on:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
branches:
- 'main'
- 'release-*'
paths-ignore:
- '**/*.md'
- 'docs/**'
- '.gitignore'
- 'LICENSE'
- 'SECURITY_CONTACTS'
- 'DCO'
- 'OWNERS'

permissions: {}

jobs:
golangci-lint:
if: github.event.pull_request.draft == false
uses: ./.github/workflows/golangci-lint.yml

unit:
if: github.event.pull_request.draft == false
uses: ./.github/workflows/unit.yml

e2e-fixture-test:
needs: [golangci-lint, unit]
uses: ./.github/workflows/e2e-fixture-test.yml

e2e-test:
needs: [golangci-lint, unit]
strategy:
# Avoid wasting CI resources
fail-fast: true
matrix:
bmc-protocol:
- redfish-virtualmedia
- ipmi
uses: ./.github/workflows/e2e-test.yml
with:
bmc-protocol: ${{ matrix.bmc-protocol }}
25 changes: 25 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: unit

on:
workflow_call:

# Remove all permissions from GITHUB_TOKEN except metadata.
permissions: {}

jobs:
golangci:
name: unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Calculate go version
id: vars
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.vars.outputs.go_version }}
- name: Run unit tests
run: make -e unit-cover
env:
TEST_FLAGS: "-v"