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

feat: macos builds #15

Merged
merged 1 commit into from
Dec 11, 2023
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
10 changes: 5 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
- name: Lint
run: task lint
shell: nix develop --command bash -e {0}
- name: Vulns
run: snyk auth $SNYK_TOKEN && task vulns
shell: nix develop --command bash -e {0}
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
# - name: Vulns
# run: snyk auth $SNYK_TOKEN && task vulns
# shell: nix develop --command bash -e {0}
# env:
# SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ permissions:

jobs:
goreleaser:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Nix
uses: cachix/install-nix-action@v22
- name: Setup Docker
run: |
brew install docker
colima start
- name: Release
run: task release
shell: nix develop --command bash -e {0}
Expand Down
143 changes: 98 additions & 45 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,82 @@
env:
- CGO_ENABLED=1
- SDK=/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk

builds:
# - id: armaria-darwin-amd64
# binary: armaria
# main: ./cmd/cli
# goarch:
# - amd64
# goos:
# - darwin
# env:
# - CC=zig cc -target x86_64-macos-none -g0
# - CXX=zig c++ -target x86_64-macos-none -g0
# flags:
# - -trimpath
# - -tags=fts5 netgo osusergo
# - -buildmode=pie
# ldflags:
# - -s
# - -w
# - -X "main.version={{ .Version }}"

# - id: armaria-darwin-arm64
# binary: armria
# main: ./cmd/cli
# goarch:
# - arm64
# goos:
# - darwin
# env:
# - CC=zig cc -target aarch64-macos-none -g0
# - CXX=zig c++ -target aarch64-macos-none -g0
# flags:
# - -trimpath
# - -tags=fts5 netgo osusergo
# - -buildmode=pie
# ldflags:
# - -s
# - -w
# - -X "main.version={{ .Version }}"

- id: armaria-darwin-amd64
binary: armaria
main: ./cmd/cli
goarch:
- amd64
goos:
- darwin
env:
- CC=zig cc -target x86_64-macos -g0 --sysroot={{ .Env.SDK }} -I{{ .Env.SDK }}/usr/include -L{{ .Env.SDK }}/usr/lib -F{{ .Env.SDK }}/System/Library/Frameworks -framework CoreFoundation -Wno-expansion-to-defined -Wno-availability -Wno-nullability-completeness
- CXX=zig c++ -target x86_64-macos -g0 --sysroot={{ .Env.SDK }} -I{{ .Env.SDK }}/usr/include -L{{ .Env.SDK }}/usr/lib -F{{ .Env.SDK }}/System/Library/Frameworks -framework CoreFoundation -Wno-expansion-to-defined -Wno-availability -Wno-nullability-completeness
flags:
- -trimpath
- -tags=fts5
- -buildmode=pie
ldflags:
- -s
- -w
- -X "main.version={{ .Version }}"

- id: armaria-host-darwin-amd64
binary: armaria
main: ./cmd/host
goarch:
- amd64
goos:
- darwin
env:
- CC=zig cc -target x86_64-macos -g0 --sysroot={{ .Env.SDK }} -I{{ .Env.SDK }}/usr/include -L{{ .Env.SDK }}/usr/lib -F{{ .Env.SDK }}/System/Library/Frameworks -framework CoreFoundation -Wno-expansion-to-defined -Wno-availability -Wno-nullability-completeness
- CXX=zig c++ -target x86_64-macos -g0 --sysroot={{ .Env.SDK }} -I{{ .Env.SDK }}/usr/include -L{{ .Env.SDK }}/usr/lib -F{{ .Env.SDK }}/System/Library/Frameworks -framework CoreFoundation -Wno-expansion-to-defined -Wno-availability -Wno-nullability-completeness
flags:
- -trimpath
- -tags=fts5
- -buildmode=pie
ldflags:
- -s
- -w

- id: armaria-darwin-arm64
binary: armria
main: ./cmd/cli
goarch:
- arm64
goos:
- darwin
env:
- CC=zig cc -target aarch64-macos -g0 --sysroot={{ .Env.SDK }} -I{{ .Env.SDK }}/usr/include -L{{ .Env.SDK }}/usr/lib -F{{ .Env.SDK }}/System/Library/Frameworks -framework CoreFoundation -Wno-expansion-to-defined -Wno-availability -Wno-nullability-completeness
- CXX=zig c++ -target aarch64-macos -g0 --sysroot={{ .Env.SDK }} -I{{ .Env.SDK }}/usr/include -L{{ .Env.SDK }}/usr/lib -F{{ .Env.SDK }}/System/Library/Frameworks -framework CoreFoundation -Wno-expansion-to-defined -Wno-availability -Wno-nullability-completeness
flags:
- -trimpath
- -tags=fts5
- -buildmode=pie
ldflags:
- -s
- -w
- -X "main.version={{ .Version }}"

- id: armaria-host-darwin-arm64
binary: armria
main: ./cmd/host
goarch:
- arm64
goos:
- darwin
env:
- CC=zig cc -target aarch64-macos -g0 --sysroot={{ .Env.SDK }} -I{{ .Env.SDK }}/usr/include -L{{ .Env.SDK }}/usr/lib -F{{ .Env.SDK }}/System/Library/Frameworks -framework CoreFoundation -Wno-expansion-to-defined -Wno-availability -Wno-nullability-completeness
- CXX=zig c++ -target aarch64-macos -g0 --sysroot={{ .Env.SDK }} -I{{ .Env.SDK }}/usr/include -L{{ .Env.SDK }}/usr/lib -F{{ .Env.SDK }}/System/Library/Frameworks -framework CoreFoundation -Wno-expansion-to-defined -Wno-availability -Wno-nullability-completeness
flags:
- -trimpath
- -tags=fts5
- -buildmode=pie
ldflags:
- -s
- -w

- id: armaria-linux-amd64
binary: armaria
main: ./cmd/cli
Expand Down Expand Up @@ -116,13 +153,19 @@ builds:
- -s
- -w

# universal_binaries:
# - id: armaria-darwin-universal
# ids:
# - armaria-darwin-amd64
# - armaria-darwin-arm64
# replace: true
# name_template: "armaria"
universal_binaries:
- id: armaria-darwin-universal
ids:
- armaria-darwin-amd64
- armaria-darwin-arm64
replace: true
name_template: "armaria"
- id: armaria-host-darwin-universal
ids:
- armaria-host-darwin-amd64
- armaria-host-darwin-arm64
replace: true
name_template: "armaria-host"

archives:
- id: armaria-linux-archive
Expand All @@ -143,6 +186,15 @@ archives:
format: zip
files:
- none*
- id: armaria-macos-archive
builds:
- armaria-darwin-universal
- armaria-host-darwin-universal
name_template: "armaria_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
wrap_in_directory: false
format: zip
files:
- none*

checksum:
name_template: 'checksums.txt'
Expand Down Expand Up @@ -217,3 +269,4 @@ chocolateys:
ids:
- armaria-windows-archive
api_key: "{{ .Env.CHOCOLATEY_API_KEY }}"
skip_publish: true
36 changes: 35 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,31 @@
flake = false;
};
zig.url = "github:mitchellh/zig-overlay";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-compat, zig }:
let pkgs = import nixpkgs {
system = "x86_64-linux";
};
in
{
devShell.x86_64-linux =
pkgs.mkShell {
outputs = { self, nixpkgs, flake-compat, flake-utils, zig }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs;[
go_1_21
gopls
go-task
golangci-lint
goose
zig.packages.${system}.master
# https://github.com/ziglang/zig/issues/17130
zig.packages.${system}.master-2023-08-15
goreleaser
syft
snyk
# snyk
];
shellHook = ''
export PATH=$PWD/tools:$PATH
'';
};
};
}
);
}