Skip to content

Commit 116b93c

Browse files
authored
Merge pull request #19 from Leaseweb/dev_to_main
develop to main Bring all but a few changes from develop to the main branch
2 parents 0c5fad4 + 550b025 commit 116b93c

File tree

130 files changed

+2148
-2839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+2148
-2839
lines changed

.github/workflows/go-coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ on:
99

1010
jobs:
1111
build:
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-20.04
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-go@v2
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
1616
with:
17-
go-version: 1.19.3
17+
go-version: '1.21'
1818
- name: Run go test with coverage
1919
run: COVER_PROFILE=coverage.txt make test
2020
- name: Codecov upload

.github/workflows/pr-check.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: PR Check
2+
3+
on:
4+
pull_request: {}
5+
6+
jobs:
7+
lint:
8+
name: Lint
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- name: Install Go 1.x
12+
uses: actions/setup-go@v5
13+
with:
14+
go-version: '1.21'
15+
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
19+
- name: Run unit tests
20+
run: make lint
21+
22+
build:
23+
name: Test & Build
24+
runs-on: ubuntu-20.04
25+
steps:
26+
- name: Install Go 1.x
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version: '1.21'
30+
31+
- name: Check out code
32+
uses: actions/checkout@v4
33+
34+
- name: Cache
35+
uses: actions/cache@v3
36+
with:
37+
path: ~/go/pkg/mod
38+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
39+
restore-keys: |
40+
${{ runner.os }}-go-
41+
42+
- name: Run unit tests
43+
run: make test
44+
45+
- name: Build
46+
run: make build

.github/workflows/release.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
tags:
9+
- v*
10+
11+
env:
12+
REGISTRY: ghcr.io/leaseweb
13+
IMAGE_NAME: capi-cloudstack-controller
14+
TAG: build
15+
16+
jobs:
17+
push:
18+
name: Push images
19+
runs-on: ubuntu-20.04
20+
21+
steps:
22+
- name: Check out code
23+
uses: actions/checkout@v4
24+
# This step is run when the branch is main and no tag is set
25+
- name: Sets env vars for main
26+
run: |
27+
echo "TAG=latest" >> $GITHUB_ENV
28+
if: github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v')
29+
30+
# This step is run when the branch is develop
31+
- name: Sets env vars for develop
32+
run: |
33+
echo "TAG=develop" >> $GITHUB_ENV
34+
if: github.ref == 'refs/heads/develop'
35+
36+
# This step is run when there is a tag
37+
- name: Sets env vars for tag
38+
run: |
39+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' | sed -e 's/^v//')
40+
echo "TAG=${VERSION}" >> $GITHUB_ENV
41+
if: startsWith(github.ref, 'refs/tags/v')
42+
43+
- name: Cache
44+
uses: actions/cache@v3
45+
with:
46+
path: ~/go/pkg/mod
47+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
48+
restore-keys: |
49+
${{ runner.os }}-go-
50+
51+
- name: Build container images
52+
run: make docker-build
53+
54+
- name: Log into registry
55+
uses: docker/login-action@v3
56+
with:
57+
registry: ghcr.io
58+
username: ${{github.actor}}
59+
password: ${{secrets.GITHUB_TOKEN}}
60+
61+
- name: Push
62+
run: |
63+
docker push ${REGISTRY}/${IMAGE_NAME}:${TAG}
64+
65+
release:
66+
name: Release
67+
runs-on: ubuntu-20.04
68+
69+
# Run only if previous job has succeeded
70+
needs: [push]
71+
72+
# Create a release only for tags v*
73+
if: startsWith(github.ref, 'refs/tags/v')
74+
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
79+
- name: Build release manifests
80+
run: make release-manifests
81+
82+
- name: Release
83+
uses: softprops/action-gh-release@v1
84+
with:
85+
prerelease: false
86+
draft: true
87+
fail_on_unmatched_files: true
88+
generate_release_notes: true
89+
name: ${{ env.TAG }}
90+
files: |
91+
out/metadata.yaml
92+
out/infrastructure-components.yaml

.golangci.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ linters-settings:
2121
limitations under the License.
2222
gocyclo:
2323
min-complexity: 15
24+
revive:
25+
rules:
26+
- name: dot-imports
27+
arguments:
28+
# dot import should be ONLY allowed for ginkgo testing packages
29+
allowedPackages:
30+
- "github.com/onsi/ginkgo/v2"
31+
- "github.com/onsi/gomega"
2432

2533
linters:
2634
enable:
@@ -32,12 +40,12 @@ linters:
3240

3341
run:
3442
issues-exit-code: 1
35-
skip-dirs:
36-
- pkg/mocks
37-
- test
3843

3944
issues:
4045
# Excluding configuration per-path, per-linter, per-text and per-source
46+
exclude-dirs:
47+
- pkg/mocks
48+
- test
4149
exclude-rules:
4250
# Exclude some linters from running on tests files.
4351
- path: _test\.go

0 commit comments

Comments
 (0)