Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Improvements #40

Merged
merged 6 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/PRBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

- name: Set up Go 1.23
- name: Set up latest stable Go
uses: actions/setup-go@v5
with:
go-version: stable
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

- name: Set up Go 1.23
- name: Set up latest stable Go
uses: actions/setup-go@v5
with:
go-version: stable
Expand Down Expand Up @@ -66,32 +66,32 @@ jobs:
- name: Attest smd binary linux_amd64
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/smd_linux_amd64_v1/smd
subject-path: dist/smd_linux_amd64_v3/smd

- name: Attest smd-init binary linux_amd64
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/smd-init_linux_amd64_v1/smd-init
subject-path: dist/smd-init_linux_amd64_v3/smd-init

- name: Attest smd-loader binary linux_amd64
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/smd-loader_linux_amd64_v1/smd-loader
subject-path: dist/smd-loader_linux_amd64_v3/smd-loader

- name: Attest smd binary linux_arm64
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/smd_linux_arm64/smd
subject-path: dist/smd_linux_arm64_v8.0/smd

- name: Attest smd-init binary linux_arm64
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/smd-init_linux_arm64/smd-init
subject-path: dist/smd-init_linux_arm64_v8.0/smd-init

- name: Attest smd-loader binary linux_arm64
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/smd-loader_linux_arm64/smd-loader
subject-path: dist/smd-loader_linux_arm64_v8.0/smd-loader

- name: generate build provenance of docker container
uses: actions/attest-build-provenance@v1
Expand Down
62 changes: 40 additions & 22 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2.4
project_name: smd
before:
hooks:
Expand Down Expand Up @@ -25,17 +26,15 @@ builds:
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
goamd64:
- v3

env:
- CGO_ENABLED=1
- >-
CC={{- if eq .Os "linux" -}}
{{- if eq .Arch "amd64" -}}gcc{{- else -}}aarch64-linux-gnu-gcc{{- end -}}
{{- else if eq .Os "darwin" -}}
{{- if eq .Arch "amd64" -}}clang{{- else -}}clang -target arm64-apple-macos11{{- end -}}
{{- end }}
- CGO_ENABLED=0

- id: smd-init
main: ./cmd/smd-init/
Expand All @@ -53,17 +52,16 @@ builds:
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
goamd64:
- v3

env:
- CGO_ENABLED=1
- >-
CC={{- if eq .Os "linux" -}}
{{- if eq .Arch "amd64" -}}gcc{{- else -}}aarch64-linux-gnu-gcc{{- end -}}
{{- else if eq .Os "darwin" -}}
{{- if eq .Arch "amd64" -}}clang{{- else -}}clang -target arm64-apple-macos11{{- end -}}
{{- end }}
- CGO_ENABLED=0


- id: smd-loader
main: ./cmd/smd-loader/
Expand All @@ -81,17 +79,16 @@ builds:
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
goamd64:
- v3


env:
- CGO_ENABLED=1
- >-
CC={{- if eq .Os "linux" -}}
{{- if eq .Arch "amd64" -}}gcc{{- else -}}aarch64-linux-gnu-gcc{{- end -}}
{{- else if eq .Os "darwin" -}}
{{- if eq .Arch "amd64" -}}clang{{- else -}}clang -target arm64-apple-macos11{{- end -}}
{{- end }}
- CGO_ENABLED=0

dockers:
- image_templates:
Expand All @@ -107,6 +104,8 @@ dockers:
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
goarch: amd64
goamd64: v3

extra_files:
- LICENSE
- CHANGELOG.md
Expand Down Expand Up @@ -168,7 +167,26 @@ archives:
- CHANGELOG.md
- README.md


nfpms:
- id: smd
formats:
- deb
- rpm
- apk
maintainer: "Alex Lovell-Troy <[email protected]>"
description: "SMD is a tool for managing the inventory of an HPC system. Read more at https://www.openchami.org"
homepage: "https://www.openchami.org"
license: MIT
section: utils
priority: optional
contents:
- src: dist/smd_{{ .Os }}_{{ if eq .Arch "amd64" }}{{ .Arch }}_{{ .Amd64 }}{{ else if eq .Arch "arm64" }}{{ .Arch }}_{{ .Arm64 }}{{ else }}{{ .Arch }}{{ end }}/smd
dst: /usr/local/bin/smd
- src: dist/smd-init_{{ .Os }}_{{ if eq .Arch "amd64" }}{{ .Arch }}_{{ .Amd64 }}{{ else if eq .Arch "arm64" }}{{ .Arch }}_{{ .Arm64 }}{{ else }}{{ .Arch }}{{ end }}/smd-init
dst: /usr/local/bin/smd-init
- src: dist/smd-loader_{{ .Os }}_{{ if eq .Arch "amd64" }}{{ .Arch }}_{{ .Amd64 }}{{ else if eq .Arch "arm64" }}{{ .Arch }}_{{ .Arm64 }}{{ else }}{{ .Arch }}{{ end }}/smd-loader
dst: /usr/local/bin/smd-loader

checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ RUN apk add --no-cache tini

# Include curl in the final image.
RUN set -ex \
&& apk -U upgrade \
&& apk add --no-cache curl
&& apk update \
&& apk add --no-cache curl tini \
alexlovelltroy marked this conversation as resolved.
Show resolved Hide resolved
&& rm -rf /var/cache/apk/* \
&& rm -rf /tmp/*

COPY smd /
COPY smd-loader /
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ Once the environment variables are set, you can build the project locally using

Follow the installation instructions from [GoReleaser’s documentation](https://goreleaser.com/install/).

1. Run GoReleaser in snapshot mode with the --snapshot and --skip-publish flags to create a local build without attempting to release it:
1. Run GoReleaser in snapshot mode with the --snapshot flag to create a local build without attempting to release it:
```bash
goreleaser release --snapshot --skip-publish --clean
goreleaser release --snapshot --clean
```
2. Check the dist/ directory for the built binaries, which will include the metadata from the environment variables. You can inspect the binary output to confirm that the metadata was correctly embedded.

__NOTE__ If you see errors, ensure that you are using the same version of goreleaser that is being used in the [Release Action](.github/workflows/Release.yml)


The rest of this README is unchanged from the HPE version.
Expand Down
Loading