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

fix: github workflows set CGO_ENABLED=0 on for build job #174

Merged
merged 1 commit into from
Sep 10, 2024
Merged
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
fix: github workflows set CGO_ENABLED=0 on for build job
l-hellmann committed Sep 10, 2024
commit 400477859bebd1f2fe5f54d95d1d96c5b687ad74
11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@ on:
branches: [ main ]

jobs:

build:

name: Build && tests for ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: '0'
strategy:
matrix:
include:
@@ -20,29 +20,32 @@ jobs:
osEnv: GOOS=linux GOARCH=amd64
runLint: true
runTests: true

- name: linux 386
os: ubuntu-latest
osEnv: GOOS=linux GOARCH=386
runLint: true
runTests: true

- name: darwin amd64
os: macos-latest
osEnv: GOOS=darwin GOARCH=amd64
runLint: true
runTests: true

- name: darwin arm64
os: macos-latest
osEnv: GOOS=darwin GOARCH=arm64
runLint: false
runTests: false

- name: windows amd64
os: ubuntu-latest
osEnv: GOOS=windows GOARCH=amd64
runLint: false
runTests: false

steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v4

@@ -51,8 +54,6 @@ jobs:
with:
go-version-file: "go.mod"
id: go
env:
CGO_ENABLED: 0

- name: Get dependencies
run: |
40 changes: 24 additions & 16 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Upload build asset
name: Tag

on:
release:
types: [published]

jobs:
build:
name: Upload build asset for ${{ matrix.name }}
name: Build & upload ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: '0'
strategy:
matrix:
include:
@@ -19,6 +21,7 @@ jobs:
strip: true
runLint: true
runTests: true

- name: linux 386
os: ubuntu-latest
buildCmd: env GOOS=linux GOARCH=386 go build -o builds/zcli-linux-i386 -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
@@ -27,6 +30,7 @@ jobs:
strip: true
runLint: true
runTests: true

- name: darwin amd64
os: macos-latest
buildCmd: env GOOS=darwin GOARCH=amd64 go build -o builds/zcli-darwin-amd64 -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
@@ -35,6 +39,7 @@ jobs:
strip: false
runLint: true
runTests: true

- name: darwin arm64
os: macos-latest
buildCmd: env GOOS=darwin GOARCH=arm64 go build -o builds/zcli-darwin-arm64 -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
@@ -43,6 +48,7 @@ jobs:
strip: false
runLint: false
runTests: false

- name: windows amd64
os: ubuntu-latest
buildCmd: env GOOS=windows GOARCH=amd64 go build -o builds/zcli-win-x64.exe -ldflags "-s -w -X github.com/zeropsio/zcli/src/cmd.version=${{ github.event.release.tag_name }}" ./cmd/zcli/main.go
@@ -53,7 +59,6 @@ jobs:
runTests: false

steps:

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

@@ -62,8 +67,6 @@ jobs:
with:
go-version-file: "go.mod"
id: go
env:
CGO_ENABLED: 0

- name: Get dependencies
run: |
@@ -103,17 +106,6 @@ jobs:
asset_name: ${{ matrix.file }}
asset_content_type: application/octet-stream

- name: Notify discord about new release
uses: sarisia/actions-status-discord@v1.15.0
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "New version of `zcli` is ready!"
description: |
Version `${{ github.event.release.tag_name }}`
Changelog [here](${{ github.event.release.html_url }})
color: 0xff91a4
username: GitHub

publish-npm:
needs: build
runs-on: ubuntu-latest
@@ -131,3 +123,19 @@ jobs:
npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

report:
needs: build
runs-on: ubuntu-latest
steps:
- name: Notify discord about new release
uses: sarisia/actions-status-discord@v1.15.0
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "New version of `zcli` is ready!"
nocontext: 'true'
description: |
Version `${{ github.event.release.tag_name }}`
Changelog [here](${{ github.event.release.html_url }})
color: 0xff91a4
username: GitHub
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.0.25] - 2024-09-10
## [v1.0.26] - 2024-09-10

### Changed
- Build binaries with CGO_ENABLED=0