diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..98f57080e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,15 @@ +on: [push, pull_request] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build latest + run: docker build -t goharbor/harbor-operator:${{ github.sha }} + - run: docker tag goharbor/harbor-operator:${{ github.sha }} goharbor/harbor-operator:dev + if: github.head_ref == 'master' + # TODO Push image to the registry + - run: docker tag goharbor/harbor-operator:${{ github.sha }} goharbor/harbor-operator:${{ github.ref }} + if: github.head_ref != 'master' + # TODO Push image to the registry diff --git a/.github/workflows/golang.yml b/.github/workflows/golang.yml new file mode 100644 index 000000000..ef092d2b1 --- /dev/null +++ b/.github/workflows/golang.yml @@ -0,0 +1,35 @@ +on: + pull_request: + branches: + - master + +jobs: + go-dependencies: + runs-on: ubuntu-latest + name: Dependencies are up to date + steps: + - uses: actions/setup-go@v1 + with: + go-version: 1.13 + - name: Checkout + uses: actions/checkout@v2 + - run: go mod tidy + - run: go mod vendor + - run: go mod graph + - run: git status + - name: Check diff + run: test -z "$(git diff-index --diff-filter=d --name-only HEAD -- 'vendor' | grep -v 'vendor/modules.txt')" + + generated-files: + runs-on: ubuntu-latest + name: Generated files are up to date + steps: + - uses: actions/setup-go@v1 + with: + go-version: 1.13 + - name: Checkout + uses: actions/checkout@v2 + - run: make generate + - name: Check diff + run: test -z "$(git diff-index --diff-filter=d --name-only HEAD -- 'vendor' | grep -v 'vendor/modules.txt')" + diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml new file mode 100644 index 000000000..c3e479377 --- /dev/null +++ b/.github/workflows/kubernetes.yml @@ -0,0 +1,39 @@ +on: push + +jobs: + crd: + runs-on: ubuntu-latest + name: ./config/crd validation + steps: + - run: sudo apt-get install -y bzr # Required to install controller-gen in make manifests + - uses: actions/checkout@v2 + - run: make manifests + - uses: azure/k8s-bake@v1 + with: + renderEngine: 'kustomize' + kustomizationPath: './config/crd' + kubectl-version: 'latest' + + operator: + runs-on: ubuntu-latest + name: ./config/default validation + steps: + - run: sudo apt-get install -y bzr # Required to install controller-gen in make manifests + - uses: actions/checkout@v2 + - run: make manifests + - uses: azure/k8s-bake@v1 + with: + renderEngine: 'kustomize' + kustomizationPath: './config/default' + kubectl-version: 'latest' + + samples: + runs-on: ubuntu-latest + name: ./config/samples validation + steps: + - uses: actions/checkout@v2 + - uses: azure/k8s-bake@v1 + with: + renderEngine: 'kustomize' + kustomizationPath: './config/samples' + kubectl-version: 'latest' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..a2f368374 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +on: + pull_request: + branches: + - master + +jobs: + go-lint: + runs-on: ubuntu-latest + name: GoLint + steps: + - uses: actions/checkout@v2 + - name: Run golangci-lint + uses: actions-contrib/golangci-lint@v1 + with: + golangci_lint_version: 1.22.2 + + md-lint: + runs-on: ubuntu-latest + name: MdLint + steps: + - uses: actions/checkout@v2 + - name: markdownlint-cli + uses: nosborn/github-action-markdown-cli@v1.1.1 + with: + files: . + config_file: ".markdownlint.json" + ignore_files: "vendor" + + docker-lint: + runs-on: ubuntu-latest + name: DockerLint + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: lint + uses: luke142367/Docker-Lint-Action@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARGET: Dockerfile