From ee5fe8a9f33cedabf429ec1cceac760ad832cab2 Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 9 Oct 2022 07:21:41 +0200 Subject: [PATCH 1/3] .github/workflows: parallelize build process --- .github/workflows/build.yml | 65 ++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f2f2699..11e96554 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,16 @@ jobs: name: Build binaries runs-on: ubuntu-latest environment: "Build, sign, release binaries" + strategy: + matrix: + include: + - {os: linux, arch: amd64} + - {os: linux, arch: arm, arm: 6} + - {os: linux, arch: arm64} + - {os: darwin, arch: amd64} + - {os: darwin, arch: arm64} + - {os: windows, arch: amd64} + - {os: freebsd, arch: amd64} steps: - name: Install Go uses: actions/setup-go@v2 @@ -22,41 +32,36 @@ jobs: fetch-depth: 0 - name: Build binaries run: | - sudo apt-get update && sudo apt-get install -y osslsigncode cp LICENSE "$RUNNER_TEMP/LICENSE" echo -e "\n---\n" >> "$RUNNER_TEMP/LICENSE" curl -L "https://go.dev/LICENSE?m=text" >> "$RUNNER_TEMP/LICENSE" VERSION="$(git describe --tags)" - function build_age() { - DIR="$(mktemp -d)" - mkdir "$DIR/age" - cp "$RUNNER_TEMP/LICENSE" "$DIR/age" - go build -o "$DIR/age" -ldflags "-X main.Version=$VERSION" -trimpath ./cmd/... - if [ "$GOOS" == "windows" ]; then - if [ -n "${{ secrets.SIGN_PASS }}" ]; then - for exe in "$DIR"/age/*.exe; do - /usr/bin/osslsigncode sign -t "http://timestamp.comodoca.com" \ - -certs .github/workflows/certs/uitacllc.crt \ - -key .github/workflows/certs/uitacllc.key \ - -pass "${{ secrets.SIGN_PASS }}" \ - -n age -in "$exe" -out "$exe.signed" - mv "$exe.signed" "$exe" - done - fi - ( cd "$DIR"; zip age.zip -r age ) - mv "$DIR/age.zip" "age-$VERSION-$GOOS-$GOARCH.zip" - else - tar -cvzf "age-$VERSION-$GOOS-$GOARCH.tar.gz" -C "$DIR" age + DIR="$(mktemp -d)" + mkdir "$DIR/age" + cp "$RUNNER_TEMP/LICENSE" "$DIR/age" + go build -o "$DIR/age" -ldflags "-X main.Version=$VERSION" -trimpath ./cmd/... + if [ "$GOOS" == "windows" ]; then + sudo apt-get update && sudo apt-get install -y osslsigncode + if [ -n "${{ secrets.SIGN_PASS }}" ]; then + for exe in "$DIR"/age/*.exe; do + /usr/bin/osslsigncode sign -t "http://timestamp.comodoca.com" \ + -certs .github/workflows/certs/uitacllc.crt \ + -key .github/workflows/certs/uitacllc.key \ + -pass "${{ secrets.SIGN_PASS }}" \ + -n age -in "$exe" -out "$exe.signed" + mv "$exe.signed" "$exe" + done fi - } - export CGO_ENABLED=0 - GOOS=linux GOARCH=amd64 build_age - GOOS=linux GOARCH=arm GOARM=6 build_age - GOOS=linux GOARCH=arm64 build_age - GOOS=darwin GOARCH=amd64 build_age - GOOS=darwin GOARCH=arm64 build_age - GOOS=windows GOARCH=amd64 build_age - GOOS=freebsd GOARCH=amd64 build_age + ( cd "$DIR"; zip age.zip -r age ) + mv "$DIR/age.zip" "age-$VERSION-$GOOS-$GOARCH.zip" + else + tar -cvzf "age-$VERSION-$GOOS-$GOARCH.tar.gz" -C "$DIR" age + fi + env: + CGO_ENABLED: 0 + GOARCH: ${{ matrix.arch }} + GOARM: ${{ matrix.arm }} + GOOS: ${{ matrix.os }} - name: Upload workflow artifacts uses: actions/upload-artifact@v2 with: From c63407b22436017f6a662a62e900319f42bcf879 Mon Sep 17 00:00:00 2001 From: 0x2b3bfa0 <0x2b3bfa0+git@googlemail.com> Date: Sun, 9 Oct 2022 07:40:23 +0200 Subject: [PATCH 2/3] fixup! .github/workflows: parallelize build process --- .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 11e96554..c8e10c4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Build binaries + - name: Build binary run: | cp LICENSE "$RUNNER_TEMP/LICENSE" echo -e "\n---\n" >> "$RUNNER_TEMP/LICENSE" From d9f5a6c7d08cb48a5ebf53da3c11b44ea08085df Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Mon, 10 Oct 2022 04:41:01 +0200 Subject: [PATCH 3/3] .github/workflows: use `GO{OS,ARCH,ARM}` in matrix --- .github/workflows/build.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8e10c4f..4bffacbe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,13 +14,13 @@ jobs: strategy: matrix: include: - - {os: linux, arch: amd64} - - {os: linux, arch: arm, arm: 6} - - {os: linux, arch: arm64} - - {os: darwin, arch: amd64} - - {os: darwin, arch: arm64} - - {os: windows, arch: amd64} - - {os: freebsd, arch: amd64} + - {GOOS: linux, GOARCH: amd64} + - {GOOS: linux, GOARCH: arm, GOARM: 6} + - {GOOS: linux, GOARCH: arm64} + - {GOOS: darwin, GOARCH: amd64} + - {GOOS: darwin, GOARCH: arm64} + - {GOOS: windows, GOARCH: amd64} + - {GOOS: freebsd, GOARCH: amd64} steps: - name: Install Go uses: actions/setup-go@v2 @@ -59,9 +59,9 @@ jobs: fi env: CGO_ENABLED: 0 - GOARCH: ${{ matrix.arch }} - GOARM: ${{ matrix.arm }} - GOOS: ${{ matrix.os }} + GOOS: ${{ matrix.GOOS }} + GOARCH: ${{ matrix.GOARCH }} + GOARM: ${{ matrix.GOARM }} - name: Upload workflow artifacts uses: actions/upload-artifact@v2 with: