Lets Convert To Wails #58
This file contains hidden or 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: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| GO_VERSION: "1.22" | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| go: ["1.22", "1.23"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.out ./... | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.os == 'ubuntu-latest' && matrix.go == '1.22' | |
| with: | |
| file: ./coverage.out | |
| flags: unittests | |
| name: codecov-umbrella | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v6 | |
| with: | |
| version: latest | |
| args: --timeout=5m | |
| build-desktop: | |
| name: Build Desktop Apps | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux/amd64 | |
| name: linux-amd64 | |
| ext: "" | |
| - os: macos-latest | |
| platform: darwin/amd64 | |
| name: darwin-amd64 | |
| ext: ".app" | |
| - os: macos-latest | |
| platform: darwin/arm64 | |
| name: darwin-arm64 | |
| ext: ".app" | |
| - os: windows-latest | |
| platform: windows/amd64 | |
| name: windows-amd64 | |
| ext: ".exe" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install Wails | |
| run: go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
| - name: Install Linux dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential pkg-config libgtk-3-dev libwebkit2gtk-4.0-dev | |
| - name: Install Windows dependencies | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| choco install mingw -y | |
| choco install nsis -y | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Build Wails app | |
| run: | | |
| wails build -platform ${{ matrix.platform }} -clean | |
| - name: Package artifacts (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| mkdir -p artifacts | |
| cp build/bin/ml-notes artifacts/ml-notes-${{ matrix.name }} | |
| chmod +x artifacts/ml-notes-${{ matrix.name }} | |
| - name: Package artifacts (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| mkdir -p artifacts | |
| cp -r "build/bin/ML Notes.app" "artifacts/ML Notes-${{ matrix.name }}.app" | |
| - name: Package artifacts (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| mkdir -p artifacts | |
| cp build/bin/ml-notes.exe artifacts/ml-notes-${{ matrix.name }}.exe | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ml-notes-desktop-${{ matrix.name }} | |
| path: artifacts/* | |
| retention-days: 30 |