Skip to content

fix: mac build

fix: mac build #61

Workflow file for this run

name: Release
defaults:
run:
shell: bash
on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
jobs:
build:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
job_name: [ 'linux', 'mac_amd64', 'mac_arm64', 'windows' ]
include:
- job_name: linux
os: ubuntu-20.04
go: '1.22'
build_flags: '-include "^linux/"'
check: true
quicktest: true
racequicktest: true
deploy: true
- job_name: mac_amd64
os: macos-latest
go: '1.22'
build_flags: '-include "^darwin/amd64" -cgo'
quicktest: true
racequicktest: true
deploy: true
- job_name: mac_arm64
os: macos-latest
go: '1.22'
build_flags: '-include "^darwin/arm64" -cgo -macos-arch arm64 -cgo-cflags=-I/usr/local/include -cgo-ldflags=-L/usr/local/lib'
deploy: true
- job_name: windows
os: windows-latest
go: '1.22'
cgo: '0'
build_flags: '-include "^windows/"'
build_args: '-buildmode exe'
quicktest: true
deploy: true
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
check-latest: true
- name: Set environment variables
shell: bash
run: |
echo 'GOTAGS=${{ matrix.gotags }}' >> $GITHUB_ENV
echo 'BUILD_FLAGS=${{ matrix.build_flags }}' >> $GITHUB_ENV
echo 'BUILD_ARGS=${{ matrix.build_args }}' >> $GITHUB_ENV
if [[ "${{ matrix.goarch }}" != "" ]]; then echo 'GOARCH=${{ matrix.goarch }}' >> $GITHUB_ENV ; fi
if [[ "${{ matrix.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ matrix.cgo }}' >> $GITHUB_ENV ; fi
- name: Install Libraries on Linux
shell: bash
run: |
sudo modprobe fuse
sudo chmod 666 /dev/fuse
sudo chown root:$USER /etc/fuse.conf
sudo apt-get update
sudo apt-get install fuse libfuse-dev rpm pkg-config build-essential libgtk-3-dev libwebkit2gtk-4.0-dev
if: matrix.os == 'ubuntu-20.04'
- name: Install Libraries on macOS
shell: bash
run: |
brew update
brew install --cask macfuse
if: matrix.os == 'macos-latest'
- name: Install Libraries on Windows
shell: powershell
run: |
$ProgressPreference = 'SilentlyContinue'
choco install -y winfsp zip
echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
if ($env:GOARCH -eq "386") {
choco install -y mingw --forcex86 --force
echo "C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw32\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
# Copy mingw32-make.exe to make.exe so the same command line
# can be used on Windows as on macOS and Linux
$path = (get-command mingw32-make.exe).Path
Copy-Item -Path $path -Destination (Join-Path (Split-Path -Path $path) 'make.exe')
if: matrix.os == 'windows-latest'
- name: Print Go version and environment
shell: bash
run: |
printf "Using go at: $(which go)\n"
printf "Go version: $(go version)\n"
printf "\n\nGo environment:\n\n"
go env
printf "\n\nSystem environment:\n\n"
env
- name: Go module cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install wails
run: |
GO111MODULE=on go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Build
run: |
make binary
- uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: windows
path: build/bin/*
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-20.04'
with:
name: linux
path: build/bin/*
- uses: actions/setup-node@v3
if: matrix.os == 'macos-latest'
with:
node-version: 18
- shell: bash
if: matrix.os == 'macos-latest'
run: |
chmod +x 'build/bin/Fairdrive Desktop App.app/Contents/MacOS/Fairdrive Desktop App'
hdiutil create -volname "FDA" -srcfolder build/bin -ov -format UDZO build/bin/FDA.dmg
rm -rf 'build/bin/Fairdrive Desktop App.app'
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
- uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: ${{ matrix.job_name }}
path: build/bin/*
release:
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
with:
name: windows
path: build/bin/windows
- uses: actions/download-artifact@v3
with:
name: mac_arm64
path: build/bin/mac_arm64
- uses: actions/download-artifact@v3
with:
name: mac_amd64
path: build/bin/mac_amd64
- uses: actions/download-artifact@v3
with:
name: linux
path: build/bin/linux
- name: Display structure of downloaded files
run: ls -R
- name: Rename binaries
run: |
mv build/bin/linux/FDA build/bin/fairdrive_linux
mv build/bin/windows/FDA.exe build/bin/fairdrive_windows.exe
mv build/bin/mac_arm64/FDA.dmg build/bin/fairdrive_darwin_silicon.dmg
mv build/bin/mac_amd64/FDA.dmg build/bin/fairdrive_darwin_intel.dmg
- name : Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}