From 1cd7e2afd6d419bb03c7167a02fff5c7b7b73e9e Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 18:24:48 -0700 Subject: [PATCH 01/10] add binary build workflow --- .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..f8423312c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: Cross-Platform Build on New Tag + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - os: linux + arch: amd64 + - 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 + steps: + - uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: ${{ matrix.os }}/${{ matrix.arch }} + push: false + tags: user/app:latest + build-args: | + BUILDOS=${{ matrix.os }} + BUILDARCH=${{ matrix.arch }} + BUILDNAME=myapp-${{ matrix.os }}-${{ matrix.arch }} From 3c7a13955370c675f1f0fae75a79aef31ce3a9b8 Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 18:34:40 -0700 Subject: [PATCH 02/10] test on pr --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8423312c..94519f58c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,7 @@ name: Cross-Platform Build on New Tag on: + pull_request: push: tags: - '*' From 5533e3c21fae3e53dfd688741051e47ce5a62cb2 Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 18:38:59 -0700 Subject: [PATCH 03/10] update dockerfile path --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94519f58c..3f6cb0c87 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: uses: docker/build-push-action@v2 with: context: . - file: ./Dockerfile + file: .reproduciblebuilds/Dockerfile platforms: ${{ matrix.os }}/${{ matrix.arch }} push: false tags: user/app:latest From 0acb0fcb8fb029a33be8330a6e1bba7a984a722c Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 18:41:31 -0700 Subject: [PATCH 04/10] update dockerfile path --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f6cb0c87..d7cd5c553 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: uses: docker/build-push-action@v2 with: context: . - file: .reproduciblebuilds/Dockerfile + file: ./reproduciblebuilds/Dockerfile platforms: ${{ matrix.os }}/${{ matrix.arch }} push: false tags: user/app:latest From 6d76cee92999b994d79dfa91c06c1bc789044708 Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 18:46:58 -0700 Subject: [PATCH 05/10] update dockerfile path --- .github/workflows/build.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7cd5c553..12a35c2e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,22 +14,24 @@ jobs: include: - os: linux arch: amd64 - - 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 + # - 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 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 From 63aea91881fecbaf09dddd410797db6971d96151 Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 18:53:11 -0700 Subject: [PATCH 06/10] upload binary --- .github/workflows/build.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12a35c2e6..ce320e829 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,4 +45,15 @@ jobs: build-args: | BUILDOS=${{ matrix.os }} BUILDARCH=${{ matrix.arch }} - BUILDNAME=myapp-${{ matrix.os }}-${{ matrix.arch }} + BUILDNAME=cryptopower-${{ matrix.os }}-${{ matrix.arch }} + - name: Create Container + run: | + docker create --name temp-container user/app:latest + docker cp temp-container:/app/myapp-linux-amd64 ./myapp-linux-amd64 + docker rm temp-container + + - name: Upload Binary + uses: actions/upload-artifact@v2 + with: + name: myapp-binary + path: ./myapp-linux-amd64 \ No newline at end of file From d17e4051cbc1fadd19e0504dd5d2d106d1003e2f Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 18:57:28 -0700 Subject: [PATCH 07/10] upload binary --- .github/workflows/build.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce320e829..5fdced6e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,32 +28,42 @@ jobs: # arch: amd64 # - os: freebsd # arch: arm - steps: + 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=${{ matrix.os }} - BUILDARCH=${{ matrix.arch }} - BUILDNAME=cryptopower-${{ matrix.os }}-${{ matrix.arch }} + BUILDOS=${{ env.BUILDOS }} + BUILDARCH=${{ env.BUILDARCH }} + BUILDNAME=${{ env.BINARY_NAME }} + - name: Create Container run: | docker create --name temp-container user/app:latest - docker cp temp-container:/app/myapp-linux-amd64 ./myapp-linux-amd64 + 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: myapp-binary - path: ./myapp-linux-amd64 \ No newline at end of file + name: ${{ env.BINARY_NAME }} + path: ./${{ env.BINARY_NAME }} From 94597b7a1e1120f600be16b1a027037171c53e3a Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 18:59:51 -0700 Subject: [PATCH 08/10] upload binary --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5fdced6e3..d6b1114b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,7 @@ jobs: include: - os: linux arch: amd64 + # Uncomment and add other OS and architecture combinations as needed # - os: linux # arch: arm64 # - os: darwin @@ -32,8 +33,7 @@ jobs: BUILDOS: ${{ matrix.os }} BUILDARCH: ${{ matrix.arch }} BINARY_NAME: cryptopower-${{ matrix.os }}-${{ matrix.arch }} - - steps: + steps: - uses: actions/checkout@v2 - name: Copy instantswap file @@ -56,7 +56,7 @@ jobs: BUILDARCH=${{ env.BUILDARCH }} BUILDNAME=${{ env.BINARY_NAME }} - - name: Create Container + - 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 }} From 9f3cff2c855b007634cfe27527653109e2890820 Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 19:18:59 -0700 Subject: [PATCH 09/10] enable darwin build --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6b1114b5..4b87d2f54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,8 +19,8 @@ jobs: # arch: arm64 # - os: darwin # arch: amd64 - # - os: darwin - # arch: arm64 + - os: darwin + arch: arm64 # - os: windows # arch: amd64 # - os: windows From f94362f2abca58c7454c6b251dc73700478a07ed Mon Sep 17 00:00:00 2001 From: dreacot Date: Tue, 19 Dec 2023 19:23:04 -0700 Subject: [PATCH 10/10] attempt darwin build iwth linux --- reproduciblebuilds/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reproduciblebuilds/Dockerfile b/reproduciblebuilds/Dockerfile index 4adf82ebe..4252b2b7c 100644 --- a/reproduciblebuilds/Dockerfile +++ b/reproduciblebuilds/Dockerfile @@ -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