Skip to content

Commit

Permalink
[eclipse-kanto#328] Add all components in the .goreleaser file
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dimitrov <[email protected]>
  • Loading branch information
dimitar-dimitrow committed May 10, 2024
1 parent e21e7c9 commit af45160
Show file tree
Hide file tree
Showing 8 changed files with 278 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ jobs:
path: ${{ env.BUILD_TMP }}/update-manager
ref: ${{ github.ref }}
token: ${{ secrets.WF_AUTH }}
- name: Checkout azure-connector
uses: actions/checkout@v2
with:
repository: eclipse-kanto/azure-connector
path: ${{ env.BUILD_TMP }}/azure-connector
ref: ${{ github.ref }}
token: ${{ secrets.WF_AUTH }}
- name: Checkout aws-connector
uses: actions/checkout@v2
with:
repository: eclipse-kanto/aws-connector
path: ${{ env.BUILD_TMP }}/aws-connector
ref: ${{ github.ref }}
token: ${{ secrets.WF_AUTH }}
- name: Setup Go
uses: actions/setup-go@v2
with:
Expand Down Expand Up @@ -143,6 +157,18 @@ jobs:
go test -v -race ./... -coverprofile coverage.out -covermode atomic
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Generate azure-connector Coverage
working-directory: ${{ env.BUILD_TMP }}/azure-connector
run: |
go test ./... -v -coverprofile coverage.out -tags=unit
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Generate aws-connector Coverage
working-directory: ${{ env.BUILD_TMP }}/aws-connector
run: |
go test ./... -v -coverprofile coverage.out -tags=unit
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
221 changes: 221 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ builds:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
# local-digital-twins builds
# local-digital-twins builds
- id: build-local-digital-twins
dir: ./build-tmp/local-digital-twins
main: ./cmd/twins
Expand Down Expand Up @@ -292,6 +293,7 @@ builds:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
# suite-bootstrapping builds
# suite-bootstrapping builds
- id: build-suite-bootstrapping
dir: ./build-tmp/suite-bootstrapping
main: ./cmd/bootstrapping
Expand Down Expand Up @@ -339,6 +341,7 @@ builds:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
# file-backup builds
# file-backup builds
- id: build-file-backup
dir: ./build-tmp/file-backup
main: ./
Expand Down Expand Up @@ -386,6 +389,7 @@ builds:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
# system-metrics builds
# system-metrics builds
- id: build-system-metrics
dir: ./build-tmp/system-metrics
main: ./cmd/metrics
Expand Down Expand Up @@ -433,6 +437,7 @@ builds:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
# update-manager builds
# update-manager builds
- id: build-update-manager
dir: ./build-tmp/update-manager
main: ./cmd/update-manager
Expand Down Expand Up @@ -479,6 +484,100 @@ builds:
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
# azure-connector builds
- id: build-azure-connector
dir: ./build-tmp/azure-connector
main: ./cmd/azure-connector
binary: azure-connector/azure-connector
goos:
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 7
flags:
- -mod=readonly
- -v
- -trimpath
asmflags:
- all=-trimpath={{ .Env.GOPATH }}
gcflags:
- all=-trimpath={{ .Env.GOPATH }}
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
- id: build-azure-connector-pkg
dir: ./build-tmp/azure-connector
main: ./cmd/azure-connector
binary: azure-connector
goos:
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 7
flags:
- -mod=readonly
- -v
- -trimpath
asmflags:
- all=-trimpath={{ .Env.GOPATH }}
gcflags:
- all=-trimpath={{ .Env.GOPATH }}
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
# aws-connector builds
- id: build-aws-connector
dir: ./build-tmp/aws-connector
main: ./cmd/aws-connector
binary: aws-connector/aws-connector
goos:
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 7
flags:
- -mod=readonly
- -v
- -trimpath
asmflags:
- all=-trimpath={{ .Env.GOPATH }}
gcflags:
- all=-trimpath={{ .Env.GOPATH }}
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
- id: build-aws-connector-pkg
dir: ./build-tmp/aws-connector
main: ./cmd/aws-connector
binary: aws-connector
goos:
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 7
flags:
- -mod=readonly
- -v
- -trimpath
asmflags:
- all=-trimpath={{ .Env.GOPATH }}
gcflags:
- all=-trimpath={{ .Env.GOPATH }}
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: '{{ .CommitTimestamp }}'
archives:
- id: kanto-archive-all
name_template: '{{ .ProjectName }}_{{ .Version }}_linux_{{ if .Amd64 }}x86_64{{ else if .Arm }}armv7{{ else }}{{ .Arch }}{{ end }}'
Expand All @@ -493,6 +592,8 @@ archives:
- build-file-backup
- build-system-metrics
- build-update-manager
- build-azure-connector
- build-aws-connector
files:
# common files
- LICENSE
Expand Down Expand Up @@ -565,6 +666,28 @@ archives:
strip_parent: true
info:
mode: 0644
# azure-connector additional files
- src: ./build-tmp/azure-connector/NOTICE.md
dst: azure-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/azure-connector/cmd/azure-connector/iothub.crt
dst: azure-connector
strip_parent: true
info:
mode: 0644
# aws-connector additional files
- src: ./build-tmp/aws-connector/NOTICE.md
dst: aws-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/aws-connector/cmd/aws-connector/aws.crt
dst: aws-connector
strip_parent: true
info:
mode: 0644
- id: code-coverage
name_template: '{{ .ProjectName }}_{{ .Version }}_code_coverage'
meta: true
Expand Down Expand Up @@ -704,6 +827,36 @@ archives:
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/azure-connector/coverage.html
dst: azure-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/azure-connector/coverage.txt
dst: azure-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/azure-connector/coverage.out
dst: azure-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/aws-connector/coverage.html
dst: aws-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/aws-connector/coverage.txt
dst: aws-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/aws-connector/coverage.out
dst: aws-connector
strip_parent: true
info:
mode: 0644
nfpms:
- builds:
- build-suite-connector-pkg
Expand All @@ -716,6 +869,8 @@ nfpms:
- build-file-backup-pkg
- build-system-metrics-pkg
- build-update-manager-pkg
- build-azure-connector-pkg
- build-aws-connector-pkg
bindir: /usr/bin
file_name_template: '{{ .ProjectName }}_{{ .Version }}_linux_{{ if .Amd64 }}x86_64{{ else if .Arm }}armv7{{ else }}{{ .Arch }}{{ end }}'
maintainer: Contributors to the Eclipse Foundation, Kanto Project <[email protected]>
Expand Down Expand Up @@ -1026,6 +1181,72 @@ nfpms:
dst: /usr/share/doc/kanto-update-manager/LICENSE
file_info:
mode: 0644
# azure-connector additional resources
- src: ./build-tmp/azure-connector/resources/azure-connector.service
dst: /etc/systemd/system/azure-connector.service
file_info:
mode: 0644
packager: deb
- src: ./build-tmp/azure-connector/resources/azure-connector.service
dst: /usr/lib/systemd/system/azure-connector.service
file_info:
mode: 0644
packager: rpm
- src: ./build-tmp/azure-connector/resources/config.json
dst: /etc/azure-connector/config.json
type: config
file_info:
mode: 0644
- src: ./build-tmp/azure-connector/cmd/azure-connector/iothub.crt
dst: /etc/azure-connector/iothub.crt
type: config
file_info:
mode: 0644
- src: ./build-tmp/azure-connector/NOTICE.md
dst: /usr/share/doc/azure-connector/NOTICE.md
file_info:
mode: 0644
- src: ./build-tmp/azure-connector/README.md
dst: /usr/share/doc/azure-connector/README.md
file_info:
mode: 0644
- src: ./build-tmp/azure-connector/LICENSE
dst: /usr/share/doc/azure-connector/LICENSE
file_info:
mode: 0644
# aws-connector additional resources
- src: ./build-tmp/aws-connector/resources/aws-connector.service
dst: /etc/systemd/system/aws-connector.service
file_info:
mode: 0644
packager: deb
- src: ./build-tmp/aws-connector/resources/aws-connector.service
dst: /usr/lib/systemd/system/aws-connector.service
file_info:
mode: 0644
packager: rpm
- src: ./build-tmp/aws-connector/resources/config.json
dst: /etc/aws-connector/config.json
type: config
file_info:
mode: 0644
- src: ./build-tmp/aws-connector/cmd/aws-connector/aws.crt
dst: /etc/aws-connector/aws.crt
type: config
file_info:
mode: 0644
- src: ./build-tmp/aws-connector/NOTICE.md
dst: /usr/share/doc/aws-connector/NOTICE.md
file_info:
mode: 0644
- src: ./build-tmp/aws-connector/README.md
dst: /usr/share/doc/aws-connector/README.md
file_info:
mode: 0644
- src: ./build-tmp/aws-connector/LICENSE
dst: /usr/share/doc/aws-connector/LICENSE
file_info:
mode: 0644
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'
snapshot:
Expand Down
16 changes: 15 additions & 1 deletion build/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon
deb-systemd-helper update-state 'suite-connector.service' >/dev/null || true
fi

# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'azure-connector.service' >/dev/null || true

# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'azure-connector.service' >/dev/null || true

# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'aws-connector.service' >/dev/null || true

# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'aws-connector.service' >/dev/null || true

# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'local-digital-twins.service' >/dev/null || true

Expand Down Expand Up @@ -101,7 +115,7 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon
deb-systemd-helper update-state 'system-metrics.service' >/dev/null || true
fi

# This will only remove masks created by d-s-h on package removal.
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'kanto-update-manager.service' >/dev/null || true

# was-enabled defaults to true, so new installations run enable.
Expand Down
4 changes: 4 additions & 0 deletions build/postinst_rpm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then

# Install the Kanto services
/usr/lib/systemd/systemd-update-helper install-system-units suite-connector.service || :
/usr/lib/systemd/systemd-update-helper install-system-units azure-connector.service || :
/usr/lib/systemd/systemd-update-helper install-system-units aws-connector.service || :
/usr/lib/systemd/systemd-update-helper install-system-units local-digital-twins.service || :
/usr/lib/systemd/systemd-update-helper install-system-units suite-bootstrapping.service || :
/usr/lib/systemd/systemd-update-helper install-system-units container-management.service || :
Expand All @@ -23,6 +25,8 @@ if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
# Start the Kanto services if enabled
if [ -d /run/systemd/system ]; then
systemctl is-enabled -q suite-connector.service && systemctl start suite-connector.service >/dev/null || :
systemctl is-enabled -q azure-connector.service && systemctl azure suite-connector.service >/dev/null || :
systemctl is-enabled -q aws-connector.service && systemctl start aws-connector.service >/dev/null || :
systemctl is-enabled -q local-digital-twins.service && systemctl start local-digital-twins.service >/dev/null || :
systemctl is-enabled -q suite-bootstrapping.service && systemctl start suite-bootstrapping.service >/dev/null || :
systemctl is-enabled -q container-management.service && systemctl start container-management.service >/dev/null || :
Expand Down
Loading

0 comments on commit af45160

Please sign in to comment.