Update workflow to verify fmt
To support this, I refactored the actions to use a composite action so that all checks could run with the same setup. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
26
.github/actions/prepare/action.yml
vendored
Normal file
26
.github/actions/prepare/action.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: 'Prepare Warewulf'
|
||||||
|
description: 'Prepare environment and Warewulf source code for testing and building'
|
||||||
|
inputs:
|
||||||
|
go-version:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Install gpgme (dependency)
|
||||||
|
run: sudo apt-get install libgpgme-dev
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Setup go ${{ inputs.go-version }}
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: ${{ inputs.go-version }}
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Configure Warewulf
|
||||||
|
run: make config
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Prepare vendor directory
|
||||||
|
run: make vendor
|
||||||
|
shell: bash
|
||||||
87
.github/workflows/check.yml
vendored
Normal file
87
.github/workflows/check.yml
vendored
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
---
|
||||||
|
name: check
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- development
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- development
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: ['1.18', '1.19', '1.20']
|
||||||
|
steps:
|
||||||
|
- name: Checkout Warewulf
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: ./.github/actions/prepare
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
- name: Check Warewulf code with golang linter (golang ${{ matrix.go-version }})
|
||||||
|
run: make lint
|
||||||
|
|
||||||
|
vet:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: ['1.18', '1.19', '1.20']
|
||||||
|
steps:
|
||||||
|
- name: Checkout Warewulf
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: ./.github/actions/prepare
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
- name: Vet Warewulf code (golang ${{ matrix.go-version }})
|
||||||
|
run: make vet
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: ['1.18', '1.19', '1.20']
|
||||||
|
steps:
|
||||||
|
- name: Checkout Warewulf
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: ./.github/actions/prepare
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
- name: Check Warewulf code for formatting (golang ${{ matrix.go-version }})
|
||||||
|
run: test "$(make -s fmt | wc -l)" == 0
|
||||||
|
|
||||||
|
testsuite:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: ['1.18', '1.19', '1.20']
|
||||||
|
steps:
|
||||||
|
- name: Checkout Warewulf
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: ./.github/actions/prepare
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
- name: Run the test suite (golang ${{ matrix.go-version }})
|
||||||
|
run: make test
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go-version: ['1.18', '1.19', '1.20']
|
||||||
|
steps:
|
||||||
|
- name: Checkout Warewulf
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: ./.github/actions/prepare
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go-version }}
|
||||||
|
- name: Build Warewulf (golang ${{ matrix.go-version }})
|
||||||
|
run: make all
|
||||||
39
.github/workflows/lint.yaml
vendored
39
.github/workflows/lint.yaml
vendored
@@ -1,39 +0,0 @@
|
|||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- development
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- development
|
|
||||||
paths-ignore:
|
|
||||||
- 'docs/**'
|
|
||||||
|
|
||||||
name: golangci-lint
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix: # Pin go version to the one(s) below.
|
|
||||||
go: [ '1.17' ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Create config
|
|
||||||
run: make config
|
|
||||||
- name: Setup go ${{ matrix.go }}
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go }}
|
|
||||||
cache: true
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
uses: golangci/golangci-lint-action@v3
|
|
||||||
with:
|
|
||||||
version: v1.46.2
|
|
||||||
skip-build-cache: true
|
|
||||||
skip-pkg-cache: true
|
|
||||||
args: --build-tags "containers_image_openpgp containers_image_ostree" --timeout 5m --skip-dirs internal/pkg/staticfiles
|
|
||||||
|
|
||||||
44
.github/workflows/test.yml
vendored
44
.github/workflows/test.yml
vendored
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
name: test
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- development
|
|
||||||
paths-ignore:
|
|
||||||
- 'docs/**'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- development
|
|
||||||
paths-ignore:
|
|
||||||
- 'docs/**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
go: [ '1.18', '1.19', '1.20' ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install gpgme
|
|
||||||
run: sudo apt-get install libgpgme-dev
|
|
||||||
|
|
||||||
- name: Setup go ${{ matrix.go }}
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go }}
|
|
||||||
cache: true
|
|
||||||
|
|
||||||
- name: Build with go ${{ matrix.go }}
|
|
||||||
run: make all
|
|
||||||
|
|
||||||
- name: vet
|
|
||||||
run: make vet
|
|
||||||
|
|
||||||
- name: test
|
|
||||||
run: make test
|
|
||||||
Reference in New Issue
Block a user