try to fix ci #3
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: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install UI dependencies | |
| working-directory: web | |
| run: npm install | |
| - name: Build UI assets | |
| working-directory: web | |
| run: npm run build | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.25.3' | |
| - name: Run tests | |
| run: go test ./... | |
| cross-build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| suffix: linux-amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| suffix: linux-arm64 | |
| - goos: windows | |
| goarch: amd64 | |
| suffix: windows-amd64.exe | |
| - goos: darwin | |
| goarch: amd64 | |
| suffix: darwin-amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| suffix: darwin-arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install UI dependencies | |
| working-directory: web | |
| run: npm install | |
| - name: Build UI assets | |
| working-directory: web | |
| run: npm run build | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.25.3' | |
| - name: Cross-compile (CLI only) | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| mkdir -p dist | |
| go build -o dist/xcstrings-translator-${{ matrix.suffix }} . | |
| gui-build: | |
| runs-on: ${{ matrix.os }} | |
| needs: test | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: amd64 | |
| suffix: linux-amd64-gui | |
| install: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev pkg-config | |
| - os: windows-latest | |
| goos: windows | |
| goarch: amd64 | |
| suffix: windows-amd64-gui.exe | |
| install: | | |
| choco install -y webview2-runtime | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: arm64 | |
| suffix: darwin-arm64-gui | |
| install: "" | |
| - os: macos-15-intel | |
| goos: darwin | |
| goarch: amd64 | |
| suffix: darwin-amd64-gui | |
| install: "" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install UI dependencies | |
| working-directory: web | |
| run: npm install | |
| - name: Build UI assets | |
| working-directory: web | |
| run: npm run build | |
| - name: Install GUI dependencies | |
| if: matrix.install != '' | |
| run: ${{ matrix.install }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.25.3' | |
| - name: Build GUI binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 1 | |
| run: | | |
| mkdir -p dist | |
| go build -tags gui -o dist/xcstrings-translator-${{ matrix.suffix }} . |