WIP #1254
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Test & Release" | |
on: | |
push: | |
branches: | |
- '*' | |
release: | |
types: | |
- created | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- name: Set up Go 1.20 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.20' | |
id: go | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Run tests | |
run: go test -coverprofile c.out ./... | |
- name: Produce coverage report | |
run: go tool cover -html=c.out -o coverage.html | |
- name: Save coverage report as artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: coverage | |
path: coverage.html | |
build-linux: | |
if: ${{ github.event_name == 'release' }} | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go 1.20 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.20' | |
- name: Build on Linux | |
working-directory: ${{ github.workspace }}/cmd/transitland | |
run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build | |
- name: Store Linux binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: transitland-linux | |
path: ${{ github.workspace }}/cmd/transitland/transitland | |
build-macos: | |
if: ${{ github.event_name == 'release' }} | |
needs: test | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go 1.20 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.20' | |
- name: Build on macOS | |
working-directory: ${{ github.workspace }}/cmd/transitland | |
run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build | |
- name: Import Code-Signing Certificates | |
uses: Apple-Actions/import-codesign-certs@v1 | |
with: | |
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | |
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} | |
- name: Install gon via HomeBrew for code signing and app notarization | |
run: | | |
brew tap mitchellh/gon | |
brew install mitchellh/gon/gon | |
- name: Sign the mac binaries with Gon | |
env: | |
AC_USERNAME: ${{ secrets.AC_USERNAME }} | |
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} | |
run: | | |
gon -log-level=debug -log-json ./.github/gonconfig.json | |
- name: Store macOS binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: transitland-macos | |
path: ${{ github.workspace }}/transitland.zip | |
release: | |
if: ${{ github.event_name == 'release' }} | |
needs: [build-linux, build-macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Linux binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: transitland-linux | |
path: transitland-linux | |
- name: Attach Linux binary to GitHub release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ github.workspace }}/transitland-linux/transitland | |
asset_name: transitland-linux | |
asset_content_type: application/binary | |
- name: Download macOS binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: transitland-macos | |
path: transitland-macos | |
- name: Attach macOS binary to GitHub release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ github.workspace }}/transitland-macos/transitland.zip | |
asset_name: transitland-macos.zip | |
asset_content_type: application/binary | |
release-notes: | |
needs: release | |
if: ${{ github.event_name == 'release' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- run: npm install github-release-notes -g | |
- run: gren release --override | |
env: | |
GREN_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |