Skip to content

Commit

Permalink
Merge pull request #19 from Leaseweb/dev_to_main
Browse files Browse the repository at this point in the history
develop to main

Bring all but a few changes from develop to the main branch
  • Loading branch information
hrak authored Jul 11, 2024
2 parents 0c5fad4 + 550b025 commit 116b93c
Show file tree
Hide file tree
Showing 130 changed files with 2,148 additions and 2,839 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/go-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.19.3
go-version: '1.21'
- name: Run go test with coverage
run: COVER_PROFILE=coverage.txt make test
- name: Codecov upload
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PR Check

on:
pull_request: {}

jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Install Go 1.x
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Check out code
uses: actions/checkout@v4

- name: Run unit tests
run: make lint

build:
name: Test & Build
runs-on: ubuntu-20.04
steps:
- name: Install Go 1.x
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Check out code
uses: actions/checkout@v4

- name: Cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run unit tests
run: make test

- name: Build
run: make build
92 changes: 92 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Release

on:
push:
branches:
- main
- develop
tags:
- v*

env:
REGISTRY: ghcr.io/leaseweb
IMAGE_NAME: capi-cloudstack-controller
TAG: build

jobs:
push:
name: Push images
runs-on: ubuntu-20.04

steps:
- name: Check out code
uses: actions/checkout@v4
# This step is run when the branch is main and no tag is set
- name: Sets env vars for main
run: |
echo "TAG=latest" >> $GITHUB_ENV
if: github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v')

# This step is run when the branch is develop
- name: Sets env vars for develop
run: |
echo "TAG=develop" >> $GITHUB_ENV
if: github.ref == 'refs/heads/develop'

# This step is run when there is a tag
- name: Sets env vars for tag
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' | sed -e 's/^v//')
echo "TAG=${VERSION}" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')

- name: Cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build container images
run: make docker-build

- name: Log into registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: Push
run: |
docker push ${REGISTRY}/${IMAGE_NAME}:${TAG}
release:
name: Release
runs-on: ubuntu-20.04

# Run only if previous job has succeeded
needs: [push]

# Create a release only for tags v*
if: startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build release manifests
run: make release-manifests

- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: false
draft: true
fail_on_unmatched_files: true
generate_release_notes: true
name: ${{ env.TAG }}
files: |
out/metadata.yaml
out/infrastructure-components.yaml
14 changes: 11 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ linters-settings:
limitations under the License.
gocyclo:
min-complexity: 15
revive:
rules:
- name: dot-imports
arguments:
# dot import should be ONLY allowed for ginkgo testing packages
allowedPackages:
- "github.com/onsi/ginkgo/v2"
- "github.com/onsi/gomega"

linters:
enable:
Expand All @@ -32,12 +40,12 @@ linters:

run:
issues-exit-code: 1
skip-dirs:
- pkg/mocks
- test

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-dirs:
- pkg/mocks
- test
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
Expand Down
Loading

0 comments on commit 116b93c

Please sign in to comment.