Skip to content

test: more usage

test: more usage #201

Workflow file for this run

name: Test
on:
push:
branches-ignore:
- '*-prebuilt'
- 'release/**'
tags:
- 'v**'
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
acceptance-test:
name: Acceptance Test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64, arm]
exclude:
- goarch: arm64
goos: windows
- goarch: amd64
goos: linux
- goarch: amd64
goos: windows
- goarch: arm
goos: darwin
- goarch: arm
goos: windows
include:
- goos: linux
goarch: amd64
goamd64: v1
- goos: linux
goarch: amd64
goamd64: v3
- goos: windows
goarch: amd64
goamd64: v1
- goos: windows
goarch: amd64
goamd64: v3
- goos: darwin
goarch: amd64
- goos: linux
goarch: arm
goarm: "7"
steps:
# - name: Wait release docker build for release branches
# if: contains(github.ref, 'release')
# uses: jakejarvis/wait-action@master
# with:
# time: '300s'
- name: Checkout
uses: actions/checkout@v4
- name: Set BUILD_TIME env
run: echo BUILD_TIME=$(date) >> ${GITHUB_ENV}
- name: Run go-release-action on test code
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goamd64: ${{ matrix.goamd64 }}
goarm: ${{ matrix.goarm }}
goversion: https://go.dev/dl/go1.19.7.linux-amd64.tar.gz
project_path: ./test/
binary_name: testmain
pre_command: go mod init localtest
executable_compression: upx -v
build_flags: -v
ldflags: -X "main.buildTime=${{ env.BUILD_TIME }}" -X main.gitCommit=${{ github.sha }} -X main.gitRef=${{ github.ref }}
md5sum: false
sha256sum: true
overwrite: true
release_tag: v0.1-test-assets
asset_name: testmain-acceptance-${{ matrix.goos }}-${{ matrix.goarch }}
retry: 5
post_command: echo "RELEASE_ASSET_FILE=$RELEASE_ASSET_FILE"
setup-go-test:
name: Set up Go Test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64]
# "" means default
goversion: ["", "1.21", "1.21.1", "https://go.dev/dl/go1.21.6.linux-amd64.tar.gz"]
steps:
# - name: Wait release docker build for release branches
# if: contains(github.ref, 'release')
# uses: jakejarvis/wait-action@master
# with:
# time: '300s'
- name: Checkout
uses: actions/checkout@v4
- name: Set GO_VERSION_TAG env
run: echo GO_VERSION_TAG=$(basename ${{ matrix.goversion }}) >> ${GITHUB_ENV}
- name: Run go-release-action on test code
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: ${{ matrix.goversion }}
project_path: ./test/
binary_name: testmain
pre_command: go mod init localtest
build_flags: -v
ldflags: -X "main.buildTime=${{ env.BUILD_TIME }}" -X main.gitCommit=${{ github.sha }} -X main.gitRef=${{ github.ref }}
md5sum: false
overwrite: true
release_tag: v0.1-test-assets
asset_name: testmain-set-up-go-${{ env.GO_VERSION_TAG }}-${{ matrix.goos }}-${{ matrix.goarch }}
setup-go-with-gomod-test:
name: Set up Go with go.mod Test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64]
goversion: ["go.mod", "./go.mod", ""]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set GO_VERSION_TAG env
run: echo GO_VERSION_TAG=$(basename ${{ matrix.goversion }}) >> ${GITHUB_ENV}
- name: Generate go.mod
run: go mod init localtest
- name: Run go-release-action on test code
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: ${{ matrix.goversion }}
project_path: ./test/
binary_name: testmain
build_flags: -v
ldflags: -X "main.buildTime=${{ env.BUILD_TIME }}" -X main.gitCommit=${{ github.sha }} -X main.gitRef=${{ github.ref }}
md5sum: false
overwrite: true
release_tag: v0.1-test-assets
asset_name: testmain-set-up-go-${{ env.GO_VERSION_TAG }}-${{ matrix.goos }}-${{ matrix.goarch }}
build-via-makefile-test:
name: Makefile Build Test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run go-release-action on test code
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: https://go.dev/dl/go1.16.6.linux-amd64.tar.gz
project_path: ./test/
binary_name: testmain
pre_command: go mod init localtest
build_command: make app
md5sum: false
sha256sum: false
overwrite: true
release_tag: v0.1-test-assets
asset_name: testmain-via-makefile-${{ matrix.goos }}-${{ matrix.goarch }}
compress-assets-test:
name: Compress assets off Test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
compress_assets: ['auto', 'true', 'zip', 'off', 'false']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run go-release-action on test code
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: ./test/
binary_name: testmain
pre_command: go mod init localtest
build_flags: -v
overwrite: true
release_tag: v0.1-test-assets
compress_assets: ${{ matrix.compress_assets }}
multi-binaries-test:
name: Multi Binaries Test
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
project_path: [./test/multi-binaries/..., './test/multi-binaries/cmd1 ./test/multi-binaries/cmd2']
steps:
- name: Set BUILD_TIME env
run: echo BUILD_TIME=$(date -u +%Y%m%dT%H%M%S) >> ${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v4
- name: Run go-release-action on test code
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: ${{ matrix.project_path }}
pre_command: go mod init localtest
extra_files: LICENSE README.md
build_flags: -v -tags v0.1-test-assets-${{ env.BUILD_TIME }}
overwrite: true
release_tag: v0.1-test-assets