Skip to content

Commit

Permalink
add cgo in builds
Browse files Browse the repository at this point in the history
  • Loading branch information
altitude committed Jul 19, 2021
1 parent d0f42e6 commit 1a97afd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 42 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: '1.16'
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: actions/checkout@v2
- name: Configure git for private modules
env:
Expand All @@ -53,28 +50,3 @@ jobs:
args: build --parallelism 4 --rm-dist --skip-validate --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: numary-preprod-ecr
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Deploy new version in ECS
env:
IMAGE_TAG: ${{ github.sha }}
run: |
pip install ecs-deploy boto3
python .github/deploy_ecs_service.py $AWS_ECS_CLUSTER $IMAGE_TAG
34 changes: 22 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
include:
- arch: amd64
cc: gcc
- os: macos-latest
GOOS: darwin
- os: ubuntu-latest
GOOS: linux
GOARCH: amd64
env:
GOOS: linux
GOARCH: ${{ matrix.arch }}
# GOOS: ${{ matrix.GOOS }}
# GOARCH: ${{ matrix.GOARCH }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "eu-west-1"
Expand Down Expand Up @@ -44,26 +48,31 @@ jobs:
- name: fetch numary control
run: make fetch-control
- name: Run GoReleaser
env:
GOOS: ${{matrix.GOOS}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --parallelism 2 --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure AWS credentials
args: release --parallelism 2 --rm-dist --single-target

- if: matrix.os == 'ubuntu-latest'
name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Login to Amazon ECR
- if: matrix.os == 'ubuntu-latest'
name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build, tag, and push image to Amazon ECR
- if: matrix.os == 'ubuntu-latest'
name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: numary-prod-ecr
Expand All @@ -73,7 +82,8 @@ jobs:
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Deploy new version in ECS
- if: matrix.os == 'ubuntu-latest'
name: Deploy new version in ECS
env:
IMAGE_TAG: ${{ steps.get_release.outputs.tag_name }}
run: |
Expand Down
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ before:
- go build -o numary
builds:
- env:
- CGO_ENABLED=0
- CGO_ENABLED=1
goos:
- linux
- darwin
goarch:
- amd64
binary: numary
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:latest
FROM archlinux:latest

ADD dist/ledger_linux_amd64/numary /usr/local/bin/numary

Expand Down

0 comments on commit 1a97afd

Please sign in to comment.