Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kononovn committed May 31, 2024
0 parents commit 3b71bf8
Show file tree
Hide file tree
Showing 6,423 changed files with 1,762,619 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
56 changes: 56 additions & 0 deletions .github/workflows/docker-image-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build Docker Image - CI

on:
release:
types:
- published
push:
branches:
- main
- 'release-\d.\d\d'

jobs:
build:
name: Build and push docker image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set image tag
shell: bash
run: |
image_tag=latest
if [ ${{ github.ref }} != 'refs/heads/main' ]; then
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
version_digits=$(echo ${branch} | tr -d -c 0-9)
image_tag=v$(echo ${version_digits} | cut -b 1).$(echo ${version_digits:1}).0
fi
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_OUTPUT
id: set_image_tag

- name: Build docker image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: eco-gotests
tags: ${{ steps.set_image_tag.outputs.IMAGE_TAG }}
containerfiles: |
./Dockerfile
archs: amd64, arm64

- name: Push To quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/ocp-edge-qe
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
password: ${{ secrets.OCP_EDGE_QE_QUAY }}

- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
37 changes: 37 additions & 0 deletions .github/workflows/docker-image-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build Docker Image - Manual

on:
workflow_dispatch:
inputs:
tag:
description: 'Docker image tag ("-unstable" postfix wil be add to every tag)'
required: true

jobs:
build:
name: Build and push docker image
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build docker image
uses: redhat-actions/buildah-build@v2
with:
image: eco-gotests
tags: ${{ github.event.inputs.tag }}-unstable
containerfiles: |
./Dockerfile
- name: Push To quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: eco-gotests
tags: ${{ github.event.inputs.tag }}-unstable
registry: quay.io/ocp-edge-qe
username: ${{ secrets.OCP_EDGE_QE_QUAY_USER }}
password: ${{ secrets.OCP_EDGE_QE_QUAY }}

- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
36 changes: 36 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Makefile CI

on:
workflow_dispatch:

push:

pull_request:
branches:
- main
- 'release-\d.\d\d'

jobs:
build:
runs-on: ubuntu-latest
env:
SHELL: /bin/bash

steps:
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19.10

- uses: actions/checkout@v3

- name: Run lint
run: make lint

- name: Install
run: make install-ginkgo

- name: Run ginkgo Dry Run
run: ginkgo run -vv -r --dry-run ./tests/
env:
ECO_DRY_RUN: true
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

.idea
reports
138 changes: 138 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
run:
timeout: 15m0s
skip-dirs-use-default: true
fast: false
# modules-download-mode: readonly

linters-settings:
revive:
rules:
- name: indent-error-flow
- name: var-naming
- name: increment-decrement
- name: exported
arguments:
- disableStutteringCheck
depguard:
list-type: blacklist
include-go-root: false
packages:
- "github.com/onsi**"
wsl:
strict-append: false
gofmt:
simplify: true
funlen:
lines: 90
statements: 40
unused:
check-exported: true
go: "1.19"
stylecheck:
dot-import-whitelist:
- github.com/onsi/gomega
- github.com/onsi/ginkgo/v2
- github.com/openshift-kni/eco-gotests/tests/internal/inittools
- github.com/openshift-kni/eco-gotests/tests/cnf/core/network/internal/netinittools
- github.com/openshift-kni/eco-gotests/tests/assisted/ztp/internal/ztpinittools
# Select the Go version to target. The default is '1.13'.
go: "1.19"
# https://staticcheck.io/docs/options#checks
checks:
- all
- ST1001

linters:
disable:
- structcheck
enable:
- asciicheck
- bidichk
- depguard
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- forcetypeassert
- funlen
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
- goheader
- goimports
- gomodguard
- goprintffuncname
- gosimple
- govet
- importas
- ineffassign
- ireturn
- lll
- makezero
- misspell
- nakedret
- nilnil
- nolintlint
- predeclared
- promlinter
- revive
- staticcheck
- stylecheck
- tenv
- thelper
- typecheck
- unconvert
- unparam
- unused
- varnamelen
- wsl
- nlreturn

output:
format: colored-line-number
issues:
exclude:
- "can't run linter goanalysis_metalinter: inspect: failed to load"
max-issues-per-linter: 0
max-same-issues: 0
new: false
include:
- EXC0002 # disable excluding of issues about comments from golint
- EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments
- EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments
exclude-rules:
#- # Exclude some linters from running on tests files.
- path: 'tests/internal/inittools'
linters:
- gochecknoinits
- path: 'tests/cnf/core/network/internal/netinittools'
linters:
- gochecknoinits
- path: 'tests/assisted/ztp/internal/ztpinittools'
linters:
- gochecknoinits
- path: 'tests/internal/reportxml'
linters:
- exhaustive

- path: 'tests/internal/reportxml'
linters:
- depguard

- path: 'tests/internal/reporter'
linters:
- depguard

- path: "tests/.*/tests/.*"
linters:
- depguard

- path: "tests/.*/.*suite_test.go"
linters:
- depguard
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM registry.access.redhat.com/ubi9/ubi:latest

ARG GO_VER=go1.19.10
ARG [email protected]
ARG CONTAINERUSER=testuser

LABEL description="eco-gotests development image"
LABEL go.version=${GO_VER}
LABEL ginkgo.version=${GINKGO_VER}
LABEL container.user=${CONTAINERUSER}

ENV PATH "$PATH:/usr/local/go/bin:/root/go/bin"
RUN dnf install -y tar gcc make && \
dnf clean metadata packages && \
arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
curl -Ls https://go.dev/dl/${GO_VER}.linux-${arch}.tar.gz |tar -C /usr/local -xzf - && \
useradd -U -u 1000 -m -d /home/${CONTAINERUSER} -s /usr/bin/bash ${CONTAINERUSER}

USER ${CONTAINERUSER}
WORKDIR /home/${CONTAINERUSER}
RUN go install github.com/onsi/ginkgo/v2/${GINKGO_VER}
COPY --chown=${CONTAINERUSER}:${CONTAINERUSER} . .

ENTRYPOINT ["scripts/test-runner.sh"]
Loading

0 comments on commit 3b71bf8

Please sign in to comment.