Skip to content

Commit

Permalink
ci/gha: intro opct workfflow w/ unified tests, isolate release
Browse files Browse the repository at this point in the history
  • Loading branch information
mtulio committed Jul 11, 2024
1 parent 01e1a44 commit 484b598
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 61 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/go.yaml

This file was deleted.

176 changes: 176 additions & 0 deletions .github/workflows/opct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: OPCT/openshift-tests-plugin

Check warning on line 1 in .github/workflows/opct.yaml

View workflow job for this annotation

GitHub Actions / yaml-lint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/opct.yaml

View workflow job for this annotation

GitHub Actions / yaml-lint

3:1 [truthy] truthy value should be one of [false, true]
push:
tags:
- '*'
pull_request:
branches:
- main
- release-*

jobs:
shell-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Shellcheck - must-gather-monitoring plugin - entrypoint
uses: azohra/shell-linter@latest
with:
path: './build.*'

- name: Shellcheck - openshift-tests-plugin
uses: azohra/shell-linter@latest
with:
path: './openshift-tests-plugin/plugin/*.sh'

- name: Shellcheck - must-gather-monitoring plugin - entrypoint
uses: azohra/shell-linter@latest
with:
path: './must-gather-monitoring/runner_plugin'

- name: Shellcheck - must-gather-monitoring plugin - collection scripts
uses: azohra/shell-linter@latest
with:
path: './must-gather-monitoring/collection-scripts/*'

- name: Shellcheck - hack
uses: azohra/shell-linter@latest
with:
path: "hack/*.sh"

yaml-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install yamllint
run: pip install yamllint

- name: Lint YAML files
run: |
echo ">> Running YAML lint on data/templates/plugins/"
yamllint .github/workflows/*.yaml
go-lint:
name: go-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.22'
cache: false

# https://github.com/golangci/golangci-lint-action
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v6.0.1
args: --timeout=10m
working-directory: openshift-tests-plugin

go-static:
name: "go-staticcheck"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: WillAbides/[email protected]
with:
go-version: '1.22'
- name: Run static code analysis
uses: dominikh/[email protected]
with:
version: "2023.1.7"
install-go: false
working-directory: openshift-tests-plugin

go-vet:
name: "go-vet"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Run go vet
run: |
go vet ./...
go-test:
name: go-test
runs-on: ubuntu-latest
needs:
- go-lint

Check failure on line 106 in .github/workflows/opct.yaml

View workflow job for this annotation

GitHub Actions / yaml-lint

106:5 [indentation] wrong indentation: expected 6 but found 4
- go-static
- go-vet
- shell-lint
- yaml-lint
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Run unit tests
working-directory: openshift-tests-plugin
run: |
go test ./...
build-binary:
runs-on: ubuntu-latest
needs:
- go-test

Check failure on line 125 in .github/workflows/opct.yaml

View workflow job for this annotation

GitHub Actions / yaml-lint

125:5 [indentation] wrong indentation: expected 6 but found 4
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make git -y
- name: Build Binary (OS=linux/amd64)
env:
OS_ARCH: linux/amd64
working-directory: openshift-tests-plugin
run: |
make build
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: openshift-tests-plugin
path: openshift-tests-plugin/openshift-tests-plugin

# build-image:

Check warning on line 153 in .github/workflows/opct.yaml

View workflow job for this annotation

GitHub Actions / yaml-lint

153:3 [comments-indentation] comment not indented like content
# runs-on: ubuntu-latest
# needs:
# - build-binary
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Set up Go
# uses: actions/setup-go@v4
# with:
# go-version: 1.22

# - name: Install dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y make git -y

# - name: Build Binary (OS=linux/amd64)
# env:
# OS_ARCH: linux/amd64
# run: |
# make build COMMAND=build PLATFORMS=linux/amd64

Check failure on line 176 in .github/workflows/opct.yaml

View workflow job for this annotation

GitHub Actions / yaml-lint

176:1 [empty-lines] too many blank lines (1 > 0)
27 changes: 6 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Plugin release
name: OPCT Plugin release
on:

Check warning on line 3 in .github/workflows/release.yaml

View workflow job for this annotation

GitHub Actions / yaml-lint

3:1 [truthy] truthy value should be one of [false, true]

Check failure on line 3 in .github/workflows/release.yaml

View workflow job for this annotation

GitHub Actions / yaml-lint

3:4 [trailing-spaces] trailing spaces
pull_request:
push:
Expand All @@ -10,35 +10,20 @@ on:
- 'release-*'

jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Shellcheck - hack
uses: azohra/shell-linter@latest
with:
path: "hack/*.sh"

- name: Shellcheck - Plugin - openshift-tests
uses: azohra/shell-linter@latest
with:
path: './openshift-tests-plugin/plugin/*.sh'

- name: Shellcheck - Plugin - openshift-tests - hack
uses: azohra/shell-linter@latest
with:
path: './openshift-tests-plugin/plugin/hack/*.sh'
opct-builder:
if: startsWith(github.ref, 'refs/tags/')
uses: ./.github/workflows/opct.yml

build-image:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- linters
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build and Push Container image
- name: Warm up build local container image x86
env:
RELEASE_VERSION: ci-${{ github.run_id }}
SKIP_ANNOTATION: "true"
Expand Down
7 changes: 5 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@ function build_plugin_tests() {
img_version=devel
img_name="quay.io/opct/clients:${img_version}"

echo "Removing manifest ${img_name} if exists..."
podman manifest rm "${img_name}" || true
# only available in newer podman version (not in GHA runner)
if [[ ${SKIP_ANNOTATION:-"false"} == "true" ]]; then
podman manifest create "${img_name}" QUAY_EXPIRATION="${IMAGE_EXPIRE_TIME}"
echo "Creating manifests skipping expiration annotation..."
podman manifest create "${img_name}"
else
podman manifest create "${img_name}" --annotation QUAY_EXPIRATION="${IMAGE_EXPIRE_TIME}"
echo "Creating manifests with expiration time of ${IMAGE_EXPIRE_TIME}..."
podman manifest create "${img_name}" --annotation QUAY_EXPIRATION="${IMAGE_EXPIRE_TIME}"
fi

for platform in "${PLATFORM_ARR[@]}"; do
Expand Down

0 comments on commit 484b598

Please sign in to comment.