name: Wasm on: push: branches: - main pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} cancel-in-progress: true jobs: js_lint: name: "JS / Lint" runs-on: ubuntu-latest env: GOOS: js GOARCH: wasm steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version-file: "go.mod" - name: Install dependencies run: sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev libpcap-dev - name: Install golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: version: latest install-mode: binary skip-cache: true skip-save-cache: true cache-invalidation-interval: 0 working-directory: ./client continue-on-error: true js_build: name: "JS / Build" runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version-file: "go.mod" - name: Build Wasm client run: GOOS=js GOARCH=wasm go build -o netbird.wasm ./client/wasm/cmd env: CGO_ENABLED: 0 - name: Check Wasm build size run: | echo "Wasm build size:" ls -lh netbird.wasm SIZE=$(stat -c%s netbird.wasm) SIZE_MB=$((SIZE / 1024 / 1024)) echo "Size: ${SIZE} bytes (${SIZE_MB} MB)" if [ ${SIZE} -gt 57671680 ]; then echo "Wasm binary size (${SIZE_MB}MB) exceeds 55MB limit!" exit 1 fi