First attempt to use GH Actions

This commit is contained in:
Sergio Padrino 2021-04-27 19:45:02 +02:00
Родитель 95a692ad7d
Коммит b0bebd92e5
2 изменённых файлов: 66 добавлений и 37 удалений

66
.github/workflows/ci.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,66 @@
name: CI
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
jobs:
build:
name: ${{ matrix.friendlyName }} ${{ matrix.arch }} (go ${{ matrix.go }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
go: [1.12.x, 1.x, x]
os: [macos-10.15]
arch: [amd64, arm64]
include:
- os: macos-10.15
friendlyName: macOS
# - os: windows-2019
# friendlyName: Windows
exclude:
# For some reason, arm64 doesn't seem to be well supported with go 1.12.x
- arch: arm64
go: 1.12.x
timeout-minutes: 60
env:
# Needed for macOS arm64 until hosted macos-11.0 runners become available
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Use go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Get app version
run: |
echo "GIT_VERSION=`git describe --tags`" >> $GITHUB_ENV
- name: Build
run: |
CGO_ENABLED=1 GOARCH=${{ matrix.arch }} GO111MODULE=on go build \
-o smimesign -ldflags "-X main.versionString=${{ env.GIT_VERSION }}" .
tar czf smimesign-${{ env.GIT_VERSION }}-macos-${{ matrix.arch }}.tgz \
smimesign
env:
TARGET_ARCH: ${{ matrix.arch }}
- name: Run tests
run: GO111MODULE=on go test -v ./...
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.go == '1.x'
with:
files: smimesign-${{ env.GIT_VERSION }}-macos-${{ matrix.arch }}.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Просмотреть файл

@ -1,37 +0,0 @@
os: osx
osx_image: xcode12.3
language: go
go:
- 1.12.x
- 1.x
- master
git:
depth: false
env:
- TARGET_ARCH: amd64
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
- TARGET_ARCH: arm64
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
install: ''
script:
- GIT_VERSION=$(git describe --tags)
- CGO_ENABLED=1 GOARCH=$TARGET_ARCH GO111MODULE=on go build -o smimesign -ldflags "-X main.versionString=$GIT_VERSION" .
- tar czf smimesign-$GIT_VERSION-macos-$TARGET_ARCH.tgz smimesign
- GO111MODULE=on go test -v ./...
deploy:
name: $GIT_VERSION
provider: releases
skip_cleanup: true
file: smimesign-$GIT_VERSION-macos-$TARGET_ARCH.tgz
on:
tags: true
go: 1.x
api_key:
secure: ETRXbCU4rdP7SE9ULTN9VqfzTiInav5LXjfvmuUo3GJTu1TmKOgsvo87aSK+ns/AkGiWXNXrHhwgfnC73jdT7o562bE/r3TG1QaBtiEcf5jn8d9HI5XXbCH1b2+yl6lpkhilDa7MxGO8d2C51gzvUyL3Zbnfqxbrploe4w3ZwnHJRObS55OQu8Ooyf1HaeK4hvoazT0Ww5Hg2joLYnB2Z9U7ucOdmQkQ8cnRZiyoSoczTnnY7JF0o83Ei5atMuDLFYR1zzKrYjBUs0Awl8tSK6t+I/dQgVYAX2QJrfkoJrXbQu5ytASvo3VUYSJkZHnGKvWi+dUbSOV+DB+uqQYYE8Ix+fOENnicuUFJuLXIWUiGJ0X3zZ2+2AeN0uHxlO1S3bJp5x8Vt5Q2uYaFQagNvkn7s9HSIy9rf6UR80a9brUiyqCQlLJcu3x+b5/KyRVyvlKupG5yD9PCv9wO1gjQts2mbCGjRQQ62Ub+PpiGQY+59jz3AjOtqrWaNkjSpAVVHkuj8Rl4X6OblCQOXskMnLk8gl2OLO7uhLlEcOUJiCbrqHZ75V1LTUa/TOx+xhQIOjTFgvbUTPQHz7eSuNVD3GuJCHMDzzUCVFaXcgX+dsDMbsqugubBRelrmCv+TS4AurCU8M3zGsZPYZV3uKt9zKIriZQ31b2hltGimRpDFDE=