Skip to content

Fix migrations

Fix migrations #1758

name: "Test & Release"
on:
push:
branches:
- '*'
release:
types:
- created
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go 1.20
uses: actions/setup-go@v5
with:
go-version: '^1.20'
id: go
- 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@v4
with:
name: coverage-${{ matrix.os }}
path: coverage.html
build-linux:
if: ${{ github.event_name == 'release' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go 1.20
uses: actions/setup-go@v5
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 -ldflags "-X main.tag=$(git describe --tags --abbrev=0)"
- name: Store Linux binary
uses: actions/upload-artifact@v4
with:
name: transitland-linux
path: ${{ github.workspace }}/cmd/transitland/transitland
build-macos-intel:
if: ${{ github.event_name == 'release' }}
needs: test
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go 1.20
uses: actions/setup-go@v5
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 -ldflags "-X main.tag=$(git describe --tags --abbrev=0)"
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v2
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 install Bearer/tap/gon
- name: Sign the mac binaries with Gon
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_PROVIDER: ${{ secrets.AC_PROVIDER }}
run: |
gon -log-level=debug -log-json ./.github/gonconfig.json
- name: Store macOS binary
uses: actions/upload-artifact@v4
with:
name: transitland-macos-intel
path: ${{ github.workspace }}/transitland.zip
build-macos-apple:
if: ${{ github.event_name == 'release' }}
needs: test
runs-on: macos-latest-xlarge # to use Apple Silicon: https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go 1.20
uses: actions/setup-go@v5
with:
go-version: '^1.20'
- name: Build on macOS
working-directory: ${{ github.workspace }}/cmd/transitland
run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.tag=$(git describe --tags --abbrev=0)"
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v2
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 install Bearer/tap/gon
- name: Sign the mac binaries with Gon
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_PROVIDER: ${{ secrets.AC_PROVIDER }}
run: |
gon -log-level=debug -log-json ./.github/gonconfig.json
- name: Store macOS binary
uses: actions/upload-artifact@v4
with:
name: transitland-macos-apple
path: ${{ github.workspace }}/transitland.zip
release:
if: ${{ github.event_name == 'release' }}
needs: [build-linux, build-macos-intel, build-macos-apple]
runs-on: ubuntu-latest
steps:
- name: Download Linux binary
uses: actions/download-artifact@v4
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 Intel binary
uses: actions/download-artifact@v4
with:
name: transitland-macos-intel
path: transitland-macos-intel
- name: Attach macOS Intel 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-intel/transitland.zip
asset_name: transitland-macos-intel.zip
asset_content_type: application/binary
- name: Download macOS Apple Silicon binary
uses: actions/download-artifact@v4
with:
name: transitland-macos-apple
path: transitland-macos-apple
- name: Attach macOS Apple Silicon 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-apple/transitland.zip
asset_name: transitland-macos-apple.zip
asset_content_type: application/binary
release-notes:
needs: release
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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 }}