Enable-macos-ci #671
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: "CI" | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Setup Go environment | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.19.x" | |
- name: Install staticcheck | |
run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
- name: Install goimports | |
run: go install golang.org/x/tools/cmd/goimports@latest | |
# Checks-out the repository under $GITHUB_WORKSPACE | |
- uses: actions/checkout@v3 | |
# Run linters | |
- name: Run go vet | |
run: go vet ./... | |
- name: Run goimports | |
run: test -z $(find . -name '*.go' -type f | xargs goimports -e -d | tee /dev/stderr) | |
- name: Run staticcheck | |
run: staticcheck ./... | |
test: | |
name: "Test" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# use max/min supported Go versions | |
go-version: ["1.21.x", "1.17.x"] | |
steps: | |
- name: Setup Go environment | |
id: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
# Checks-out the repository under $GITHUB_WORKSPACE | |
- uses: actions/checkout@v3 | |
# Run tests | |
- run: go test -v -cover -race ./... | |
k8s: | |
name: "Verify k8s build" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
# use max/min supported Go versions | |
go-version: ["1.18.x"] | |
steps: | |
- name: Setup Go environment | |
id: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
# Checks-out the repository under $GITHUB_WORKSPACE | |
- uses: actions/checkout@v3 | |
# Run tests | |
- run: go build -tags k8s | |
build: | |
name: "Build Calculator (${{ matrix.target.os }}, ${{ matrix.go-version }})" | |
runs-on: ${{ matrix.target.host || 'ubuntu-latest' }} | |
env: | |
GO111MODULE: on | |
strategy: | |
fail-fast: false | |
matrix: | |
# use max/min supported Go versions | |
go-version: ["1.21.x", "1.17.x"] | |
target: | |
- os: linux | |
- os: windows | |
ext: .exe | |
- os: freebsd | |
- os: android | |
args: -app-id calc.sha${{ github.sha }} | |
- os: darwin | |
args: -app-id calc.sha${{ github.sha }} | |
# Only macos-13 is supported as macos-14 is running in a VM on Mac M1 which are incompatible with docker/podman | |
host: macos-13 | |
- os: web | |
## Currently not easily supported from GitHub actions. | |
## https://github.com/fyne-io/fyne-cross/pull/104#issuecomment-1099494308 | |
# - os: ios | |
# args: -app-id calc.sha${{ github.sha }} | |
# host: macos-latest | |
steps: | |
- name: Setup Go environment | |
id: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
path: fyne-cross | |
- name: Checkout fyne-io/calculator | |
uses: actions/checkout@v3 | |
with: | |
repository: fyne-io/calculator | |
path: calculator | |
- name: Cache build artifacts | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/.cache/fyne-cross | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/go.sum') }} | |
- name: Install Fyne-cross | |
working-directory: fyne-cross | |
run: go install | |
# attempt to use "go install" but fallback to "go get" | |
- name: Install Fyne | |
run: | | |
go install fyne.io/fyne/v2/cmd/fyne@latest || | |
go get fyne.io/fyne/v2/cmd/fyne@latest | |
- name: Install Docker | |
if: ${{ runner.os == 'macos' }} | |
uses: douglascamata/setup-docker-macos-action@v1-alpha | |
- name: Build | |
working-directory: calculator | |
run: | | |
fyne-cross \ | |
${{ matrix.target.os }} \ | |
${{ matrix.target.args }} \ | |
-debug -no-cache \ | |
-name calculator${{ matrix.target.ext }} | |
build-fyneterm: | |
name: "Build Fyneterm (${{ matrix.target.os }}, ${{ matrix.go-version }})" | |
runs-on: ${{ matrix.target.host || 'ubuntu-latest' }} | |
env: | |
GO111MODULE: on | |
strategy: | |
fail-fast: false | |
matrix: | |
# use max/min supported Go versions | |
go-version: ["1.21.x", "1.17.x"] | |
target: | |
- os: linux | |
- os: windows | |
ext: .exe | |
- os: freebsd | |
- os: android | |
args: -app-id calc.sha${{ github.sha }} | |
- os: darwin | |
args: -app-id calc.sha${{ github.sha }} | |
# Only macos-13 is supported as macos-14 is running in a VM on Mac M1 which are incompatible with docker/podman | |
host: macos-13 | |
## Currently not easily supported from GitHub actions. | |
## https://github.com/fyne-io/fyne-cross/pull/104#issuecomment-1099494308 | |
# - os: ios | |
# args: -app-id calc.sha${{ github.sha }} | |
# host: macos-latest | |
steps: | |
- name: Setup Go environment | |
id: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
path: fyne-cross | |
- name: Checkout fyne-io/terminal | |
uses: actions/checkout@v3 | |
with: | |
repository: fyne-io/terminal | |
path: terminal | |
- name: Cache build artifacts | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/.cache/fyne-cross | |
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/go.sum') }} | |
- name: Install Fyne-cross | |
working-directory: fyne-cross | |
run: go install | |
# attempt to use "go install" but fallback to "go get" | |
- name: Install Fyne | |
run: | | |
go install fyne.io/fyne/v2/cmd/fyne@latest || | |
go get fyne.io/fyne/v2/cmd/fyne@latest | |
- name: Install Docker | |
if: ${{ runner.os == 'macos' }} | |
uses: douglascamata/setup-docker-macos-action@v1-alpha | |
- name: Build | |
working-directory: terminal | |
run: | | |
fyne-cross \ | |
${{ matrix.target.os }} \ | |
${{ matrix.target.args }} \ | |
-debug \ | |
-name fyneterm${{ matrix.target.ext }} cmd/fyneterm |