Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #152 from cybozu/enable-cgo-only-with-darwin
Browse files Browse the repository at this point in the history
fix: enable CGO only with macOS to fix the DNS resolution problem with macOS
  • Loading branch information
ganta authored Dec 10, 2020
2 parents 4a7ba44 + ceb45c1 commit 2c76ca7
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 149 deletions.
147 changes: 0 additions & 147 deletions .circleci/config.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI
on:
push:
branches:
- '*'
tags-ignore:
- '*'

jobs:
static-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.12.17
- uses: golangci/golangci-lint-action@v2
with:
version: v1.30.0
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.12.17
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install gotestsum
run: go get gotest.tools/gotestsum
- name: Test
run: make test
validate-renovate-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Validate Renovate config
run: npx --package renovate renovate-config-validator
package:
needs: [static-analysis, test]
# Run the build on macOS, because only the macOS version is built with CGO enabled.
# See https://github.com/golang/go/issues/12524
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.12.17
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: goreleaser/goreleaser-action@v2
with:
version: v0.149.0
install-only: true
- name: Package binaries
run: make package
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'

jobs:
release:
# Run the build on macOS, because only the macOS version is built with CGO enabled.
# See https://github.com/golang/go/issues/12524
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.12.17
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: goreleaser/goreleaser-action@v2
with:
version: v0.149.0
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.MACHINE_ACCOUNT_PAT }}
13 changes: 11 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@ before:
hooks:
- go mod download
builds:
- env:
- id: assam
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- windows
goarch:
- amd64
ldflags:
- "-s -w -X \"github.com/cybozu/assam/cmd.version={{.Version}}\" -X \"github.com/cybozu/assam/cmd.commit={{.ShortCommit}}\" -X \"github.com/cybozu/assam/cmd.date={{.Date}}\""
- id: assam-darwin
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
ldflags:
- "-s -w -X \"github.com/cybozu/assam/cmd.version={{.Version}}\" -X \"github.com/cybozu/assam/cmd.commit={{.ShortCommit}}\" -X \"github.com/cybozu/assam/cmd.date={{.Date}}\""
archives:
- replacements:
darwin: Darwin
Expand Down

0 comments on commit 2c76ca7

Please sign in to comment.