Repos / shark / ef7f38acb2
commit ef7f38acb2ac310ec71453c1349b5d588b9e30cc
Author: Bùi Thành Nhân <hi@imnhan.com>
Date:   Thu Jun 30 18:59:19 2022 +0700

    fix GH action

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 7b54063..3b245c8 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,34 +1,56 @@
-name: Build
+name: Go
 
-on: [push]
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
 
 jobs:
-  build:
-    runs-on: ['ubuntu-latest', 'windows-latest', 'macos-latest']
+
+  build-linux-win:
+    runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v3
-      - name: Set up Go
-        uses: actions/setup-go@v3
-        with:
-          go-version: 1.18
-      - name: Build
-        run: go build -v ./...
-      - name: Upload linux
-        #if: runner.os == 'Linux'
-        uses: actions/upload-artifact@v3
-        with:
-          name: shark-linux
-          path: shark
-      #- name: Upload macOS
-        #if: runner.os == 'macOS'
-        #uses: actions/upload-artifact@v3
-        #with:
-          #name: shark-osx
-          #path: shark
-
-      #- name: Upload Windows
-        #if: runner.os == 'Windows'
-        #uses: actions/upload-artifact@v3
-        #with:
-          #name: shark-win.exe
-          #path: shark.exe
+    - uses: actions/checkout@v3
+
+    - name: Set up Go
+      uses: actions/setup-go@v3
+      with:
+        go-version: 1.18
+
+    - name: Install ebiten deps
+      run: sudo apt-get install -y libc6-dev libglu1-mesa-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev libasound2-dev pkg-config
+
+    - name: Build
+      run: |
+        make linux
+        make win
+
+    - name: Upload Linux build
+      uses: actions/upload-artifact@v3
+      with:
+        name: Linux build
+        path: dist/shark-linux
+
+    - name: Upload Windows build
+      uses: actions/upload-artifact@v3
+      with:
+        name: Windows build
+        path: dist/shark-win.exe
+
+  build-mac:
+    runs-on: macos-latest
+    steps:
+    - uses: actions/checkout@v3
+
+    - uses: actions/setup-go@v3
+      with:
+        go-version: 1.18
+
+    - run: make mac
+
+    - name: Upload macOS build
+      uses: actions/upload-artifact@v3
+      with:
+        name: macOS build
+        path: dist/shark-mac
diff --git a/Makefile b/Makefile
index f32a4b2..29824a6 100644
--- a/Makefile
+++ b/Makefile
@@ -10,5 +10,8 @@ linux:
 win:
 	GOOS=windows GOARCH=amd64 go build -tags ebitensinglethread -o dist/shark-win.exe
 
+mac:
+	GOOS=darwin GOARCH=amd64 go build -tags ebitensinglethread -o dist/shark-mac
+
 clean:
 	rm -f dist/*