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

add binary build workflow #345

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Cross-Platform Build on New Tag

on:
pull_request:
push:
tags:
- '*'
Comment on lines +1 to +7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems it runs on PRs too, not just tags.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, i added the pr trigger there, so I wouldn't have to be creating and deleting tags, plus so i can test without merging, once i get all binaries building successfully i’d remove the pr trigger


jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
# Uncomment and add other OS and architecture combinations as needed
# - os: linux
# arch: arm64
# - os: darwin
# arch: amd64
- os: darwin
arch: arm64
# - os: windows
# arch: amd64
# - os: windows
# arch: 386
# - os: freebsd
# arch: amd64
# - os: freebsd
# arch: arm
env:
BUILDOS: ${{ matrix.os }}
BUILDARCH: ${{ matrix.arch }}
BINARY_NAME: cryptopower-${{ matrix.os }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v2

- name: Copy instantswap file
run: cp ./libwallet/instantswap/instant_example.json ./libwallet/instantswap/instant.json

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./reproduciblebuilds/Dockerfile
load: true
platforms: ${{ matrix.os }}/${{ matrix.arch }}
push: false
tags: user/app:latest
build-args: |
BUILDOS=${{ env.BUILDOS }}
BUILDARCH=${{ env.BUILDARCH }}
BUILDNAME=${{ env.BINARY_NAME }}

- name: Create Container and Copy Binary
run: |
docker create --name temp-container user/app:latest
docker cp temp-container:/app/${{ env.BINARY_NAME }} ./${{ env.BINARY_NAME }}
docker rm temp-container

- name: Upload Binary
uses: actions/upload-artifact@v2
with:
name: ${{ env.BINARY_NAME }}
path: ./${{ env.BINARY_NAME }}
3 changes: 3 additions & 0 deletions reproduciblebuilds/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ ARG BUILDNAME
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.35.2

ENV GO111MODULE on
ENV CGO_ENABLED=0
ENV GOOS=$BUILDOS
ENV GOARCH=$BUILDARCH

RUN go version

Expand Down
Loading