Skip to content

Commit

Permalink
Merge branch 'master' into api-catchall
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Ludwig authored Feb 23, 2022
2 parents 87d192f + 101d9ab commit 27fd687
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/couper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ def install
on_linux do
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/avenga/couper/releases/download/{{ GITHUB_REF_NAME }}/couper-{{ GITHUB_REF_NAME }}-linux-arm64.zip"
sha256 "{{ LINUX_ARM64_SHA256 }}"

def install
bin.install "couper"
end
end
if Hardware::CPU.intel?
url "https://github.com/avenga/couper/releases/download/{{ GITHUB_REF_NAME }}/couper-{{ GITHUB_REF_NAME }}-linux-amd64.zip"
sha256 "{{ LINUX_AMD64_SHA256 }}"

def install
bin.install "couper"
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ jobs:
timeout-minutes: 10
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
- name: 'wait for tests'
uses: lewagon/wait-on-check-action@v1.0.0
with:
go-version: '1.17'
id: go
- run: go version
ref: ${{ github.ref }}
check-name: 'go test & build'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10

- name: checkout
uses: actions/checkout@v2
Expand All @@ -38,9 +39,6 @@ jobs:
with:
ref: ${{ github.event.inputs.tag }}

- name: Test
run: go test -v -timeout 300s -race ./...

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
Expand All @@ -65,7 +63,7 @@ jobs:
uses: docker/setup-buildx-action@v1

- name: Build and push docker image with edge tag
if: github.event_name == 'push'
if: github.ref == 'refs/heads/master' && github.event_name == 'push' # due to release branch, pin to master
uses: docker/build-push-action@v2
with:
context: .
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: Go
name: 'go-test-build'

on:
push:
branches: [ master ]
branches: [ master, release.* ]
tags:
- v1.*
paths-ignore:
- '**/README.md'
- '.github/workflows/weekly-fuzz.yml'
pull_request:

jobs:

build:
name: Build
name: 'go test & build'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -36,4 +37,6 @@ jobs:
run: go test -v -timeout 300s -race ./...

- name: Build binary
run: go build -v -o couper .
run: |
go build -v -o couper .
./couper version
83 changes: 61 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
name: Release

on:
release:
types: [prereleased,released]
push:
tags:
- v1.*

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: 'wait for tests'
uses: lewagon/wait-on-check-action@v1.0.0
with:
ref: ${{ github.ref }}
check-name: 'go test & build'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10

linux-windows:
name: Release Go Binary
name: 'build linux and windows binaries'
runs-on: ubuntu-latest
needs:
- test
env:
VERSION_PACKAGE: 'github.com/avenga/couper/utils'
strategy:
matrix:
goos: [linux, windows]
goarch: [amd64, arm64]
fail-fast: false
outputs:
linux_amd64: ${{ steps.build.outputs.linux_amd64 }}
linux_arm64: ${{ steps.build.outputs.linux_arm64 }}
windows_amd64: ${{ steps.build.outputs.windows_amd64 }}
windows_arm64: ${{ steps.build.outputs.windows_arm64 }}
steps:
- uses: actions/checkout@v2

- name: Set outputs
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=build_date::$(date +'%F')"
- uses: wangyoucao577/go-release-action@v1.22
- uses: wangyoucao577/go-release-action@v1.25
id: build
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
Expand All @@ -31,8 +53,17 @@ jobs:
binary_name: "couper"
ldflags: "-X ${VERSION_PACKAGE}.VersionName=${GITHUB_REF_NAME} -X ${VERSION_PACKAGE}.BuildName=${{ steps.vars.outputs.sha_short }} -X ${VERSION_PACKAGE}.BuildDate=${{ steps.vars.outputs.build_date }}"
sha256sum: true
md5sum: false
asset_name: "couper-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}"
release_name: ${{ github.ref_name }}
overwrite: true
post_command: |
echo "::set-output name=${{ matrix.goos }}_${{ matrix.goarch }}::$SHA256_SUM"
macos:
name: 'build and sign MacOS binary'
runs-on: macos-11
needs:
- test
strategy:
matrix:
goarch: [amd64, arm64]
Expand All @@ -41,12 +72,17 @@ jobs:
AC_PASSWORD: ${{ secrets.MACOS_DEVELOPER_APPLICATION_PWD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_PACKAGE: 'github.com/avenga/couper/utils'
outputs:
amd64: ${{ steps.upload.outputs.amd64 }}
arm64: ${{ steps.upload.outputs.arm64 }}
steps:
- uses: actions/checkout@v2

- name: 'setup go'
uses: actions/setup-go@v2
with:
go-version: 1.17.x

- name: 'import certificate'
uses: devbotsxyz/import-signing-certificate@v1
with:
Expand All @@ -56,18 +92,18 @@ jobs:
- name: 'install gon'
run: go install github.com/mitchellh/gon/...@v0.2.3
- name: 'install assets-uploader'
run: go install github.com/wangyoucao577/assets-uploader/...@v0.8.0
- name: 'build couper'
run: go install github.com/wangyoucao577/assets-uploader/...@v0.9.0
- name: 'build Couper'
run: |
go build -ldflags "-X ${VERSION_PACKAGE}.VersionName=`git describe --tags --abbrev=0 --exact-match || git symbolic-ref -q --short HEAD` -X ${VERSION_PACKAGE}.BuildName=`git rev-parse --short HEAD` -X ${VERSION_PACKAGE}.BuildDate=`date +'%F'`" -race -v -o ./.macos/Couper.app/Contents/couper main.go
go build -ldflags "-X ${VERSION_PACKAGE}.VersionName=`git describe --tags --abbrev=0 --exact-match || git symbolic-ref -q --short HEAD` -X ${VERSION_PACKAGE}.BuildName=`git rev-parse --short HEAD` -X ${VERSION_PACKAGE}.BuildDate=`date +'%F'`" -v -o ./.macos/Couper.app/Contents/couper main.go
- name: 'cleanup finder attributes'
run: |
xattr -c ./.macos/Couper.app/Contents/Info.plist
xattr -c ./.macos/Entitlements.plist
plutil -convert xml1 .macos/Entitlements.plist && plutil -lint .macos/Entitlements.plist
- name: 'verify identity'
run: security find-identity -v
- name: 'sign couper binary'
- name: 'sign Couper binary'
run: codesign -i "binary.com.avenga.couper" -s "4B8FA10CCB8F16F9F464385768D82645831F4644" -f -v --timestamp --options runtime ./.macos/Couper.app/Contents/couper
- name: 'create signed binary archive' # keep utf8 things with ditto
run: ditto -c -k --sequesterRsrc ./.macos/Couper.app/Contents/couper ./.macos/couper.zip
Expand All @@ -82,39 +118,42 @@ jobs:
# - name: 'verify image notarization'
# run: spctl --assess --type open --context context:primary-signature -v ./.macos/couper.dmg
- name: 'upload archive'
id: 'vars'
id: 'upload'
run: |
mv ./.macos/couper.zip ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip -overwrite -repo avenga/couper -tag $GITHUB_REF_NAME -token $GITHUB_TOKEN
shasum -a 256 ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip | cut -d ' ' -f1 > ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.sha256 && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.sha256 -overwrite -repo avenga/couper -tag $GITHUB_REF_NAME -token $GITHUB_TOKEN
echo "::set-output name=${{ matrix.goarch }}::$(shasum -a 256 ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip | cut -d ' ' -f1)"
mv ./.macos/couper.zip ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip -overwrite -repo avenga/couper -releasename $GITHUB_REF_NAME -token $GITHUB_TOKEN
shasum -a 256 ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip | cut -d ' ' -f1 > ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip.sha256 && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip.sha256 -overwrite -repo avenga/couper -releasename $GITHUB_REF_NAME -token $GITHUB_TOKEN
echo "::set-output name=${{ matrix.goarch }}::$(cat ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.zip.sha256)"
# - name: 'upload image'
# run: mv ./.macos/couper.dmg ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.dmg && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.dmg -overwrite -repo avenga/couper -tag $GITHUB_REF_NAME -token $GITHUB_TOKEN -mediatype 'application/octet-stream'
# run: mv ./.macos/couper.dmg ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.dmg && github-assets-uploader -f ./couper-$GITHUB_REF_NAME-macos-${{ matrix.goarch }}.dmg -overwrite -repo avenga/couper -releasename $GITHUB_REF_NAME -token $GITHUB_TOKEN -mediatype 'application/octet-stream'
brewlease:
name: 'update homebrew formula'
runs-on: ubuntu-latest
needs:
# - linux-windows
- linux-windows
- macos
env:
MACOS_AMD64_SHA256: ${{ needs.macos.steps.vars.outputs.amd64 }}
MACOS_ARM64_SHA256: ${{ needs.macos.steps.vars.outputs.arm64 }}
steps:
- name: 'checkout'
uses: actions/checkout@v2
- name: 'prepare template'
env:
MACOS_AMD64_SHA256: ${{ needs.macos.outputs.amd64 }}
MACOS_ARM64_SHA256: ${{ needs.macos.outputs.arm64 }}
LINUX_ARM64_SHA256: ${{ needs.linux-windows.outputs.linux_arm64 }}
LINUX_AMD64_SHA256: ${{ needs.linux-windows.outputs.linux_amd64 }}
run: |
curl https://github.com/malud/temgo/releases/download/0.2.1/tg -o tg
curl -L https://github.com/malud/temgo/releases/download/0.2.1/tg -o tg
chmod +x tg
./tg -i ./github/workflows/couper.rb
./tg -i ${GITHUB_WORKSPACE}/.github/workflows/couper.rb
- name: 'publish formula'
uses: dmnemec/copy_file_to_another_repo_action@main
uses: dmnemec/copy_file_to_another_repo_action@v1.1.1
env:
API_TOKEN_GITHUB: ${{ secrets.GH_COUPER_API_TOKEN }}
with:
source_file: './github/workflows/couper.rb'
source_file: '${{ github.workspace }}/.github/workflows/couper.rb'
destination_repo: 'avenga/homebrew-couper'
destination_folder: './'
destination_branch: 'main'
destination_branch_create: 'release.${{ github.ref_name }}' # due to testing purposes; create branch for merging later on
user_email: 'gitbot@couper.io'
user_name: 'couper-gitbot'
commit_message: 'Update formula to ${GITHUB_REF_NAME} release'
commit_message: 'Update formula to ${{ github.ref_name }} release'

0 comments on commit 27fd687

Please sign in to comment.