67 lines
2.1 KiB
YAML
67 lines
2.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
- run: sudo apt-get update && sudo apt-get install -y gcc pkg-config libwayland-dev libx11-dev libx11-xcb-dev libxkbcommon-x11-dev libgles2-mesa-dev libegl1-mesa-dev libffi-dev libxcursor-dev libvulkan-dev
|
|
- run: go test ./...
|
|
|
|
build-macos:
|
|
if: github.event_name == 'workflow_dispatch' || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v'))
|
|
needs: test
|
|
name: macOS ${{ matrix.goarch }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runner: macos-15
|
|
goarch: arm64
|
|
- runner: macos-15-intel
|
|
goarch: amd64
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
- name: Build application DMG
|
|
shell: bash
|
|
run: |
|
|
if [[ "$GITHUB_REF_TYPE" == "tag" && "$GITHUB_REF_NAME" == v* ]]; then
|
|
# CFBundleShortVersionString accepts only digits and dots;
|
|
# strip any pre-release/build suffix (v1.2.3-rc1 -> 1.2.3).
|
|
version="${GITHUB_REF_NAME#v}"
|
|
version="${version%%-*}"
|
|
version="${version%%+*}"
|
|
else
|
|
version="0.0.${GITHUB_RUN_NUMBER}"
|
|
fi
|
|
./scripts/build-macos-dmg.sh "$version" "$GITHUB_RUN_NUMBER" "${{ matrix.goarch }}"
|
|
- name: Upload DMG
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
# Artifact names are immutable in upload-artifact v4+; without a
|
|
# per-arch name both matrix jobs upload to "artifact" and the
|
|
# second one fails.
|
|
name: lensm-dmg-${{ matrix.goarch }}
|
|
path: dist/*.dmg
|
|
archive: false
|
|
if-no-files-found: error
|