diff --git a/.github/workflows/golang-test-darwin.yml b/.github/workflows/golang-test-darwin.yml deleted file mode 100644 index 2b4c43cb4..000000000 --- a/.github/workflows/golang-test-darwin.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Test Code Darwin - -on: - push: - branches: - - main - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - test: - strategy: - matrix: - store: ['sqlite'] - runs-on: macos-latest - steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: "1.21.x" - - name: Checkout code - uses: actions/checkout@v3 - - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: macos-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - macos-go- - - - name: Install libpcap - run: brew install libpcap - - - name: Install modules - run: go mod tidy - - - name: check git status - run: git --no-pager diff --exit-code - - - name: Test - run: NETBIRD_STORE_ENGINE=${{ matrix.store }} go test -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' -timeout 5m -p 1 ./... diff --git a/.github/workflows/golang-test-freebsd.yml b/.github/workflows/golang-test-freebsd.yml deleted file mode 100644 index 4f13ee30e..000000000 --- a/.github/workflows/golang-test-freebsd.yml +++ /dev/null @@ -1,46 +0,0 @@ - -name: Test Code FreeBSD - -on: - push: - branches: - - main - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - test: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Test in FreeBSD - id: test - uses: vmactions/freebsd-vm@v1 - with: - usesh: true - copyback: false - release: "14.1" - prepare: | - pkg install -y go - - # -x - to print all executed commands - # -e - to faile on first error - run: | - set -e -x - time go build -o netbird client/main.go - # check all component except management, since we do not support management server on freebsd - time go test -timeout 1m -failfast ./base62/... - # NOTE: without -p1 `client/internal/dns` will fail becasue of `listen udp4 :33100: bind: address already in use` - time go test -timeout 8m -failfast -p 1 ./client/... - time go test -timeout 1m -failfast ./dns/... - time go test -timeout 1m -failfast ./encryption/... - time go test -timeout 1m -failfast ./formatter/... - time go test -timeout 1m -failfast ./iface/... - time go test -timeout 1m -failfast ./route/... - time go test -timeout 1m -failfast ./sharedsock/... - time go test -timeout 1m -failfast ./signal/... - time go test -timeout 1m -failfast ./util/... - time go test -timeout 1m -failfast ./version/... diff --git a/.github/workflows/golang-test-linux.yml b/.github/workflows/golang-test-linux.yml deleted file mode 100644 index 120b213e9..000000000 --- a/.github/workflows/golang-test-linux.yml +++ /dev/null @@ -1,127 +0,0 @@ -name: Test Code Linux - -on: - push: - branches: - - main - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - test: - strategy: - matrix: - arch: [ '386','amd64' ] - store: [ 'sqlite', 'postgres'] - runs-on: ubuntu-latest - steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: "1.21.x" - - - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install dependencies - run: sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev - - - name: Install 32-bit libpcap - if: matrix.arch == '386' - run: sudo dpkg --add-architecture i386 && sudo apt update && sudo apt-get install -y libpcap0.8-dev:i386 - - - name: Install modules - run: go mod tidy - - - name: check git status - run: git --no-pager diff --exit-code - - - name: Test - run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} NETBIRD_STORE_ENGINE=${{ matrix.store }} go test -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' -timeout 5m -p 1 ./... - - test_client_on_docker: - runs-on: ubuntu-20.04 - steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: "1.21.x" - - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install dependencies - run: sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev gcc-multilib libpcap-dev - - - name: Install modules - run: go mod tidy - - - name: check git status - run: git --no-pager diff --exit-code - - - name: Generate Iface Test bin - run: CGO_ENABLED=0 go test -c -o iface-testing.bin ./iface/ - - - name: Generate Shared Sock Test bin - run: CGO_ENABLED=0 go test -c -o sharedsock-testing.bin ./sharedsock - - - name: Generate RouteManager Test bin - run: CGO_ENABLED=0 go test -c -o routemanager-testing.bin ./client/internal/routemanager - - - name: Generate SystemOps Test bin - run: CGO_ENABLED=1 go test -c -o systemops-testing.bin -tags netgo -ldflags '-w -extldflags "-static -ldbus-1 -lpcap"' ./client/internal/routemanager/systemops - - - name: Generate nftables Manager Test bin - run: CGO_ENABLED=0 go test -c -o nftablesmanager-testing.bin ./client/firewall/nftables/... - - - name: Generate Engine Test bin - run: CGO_ENABLED=1 go test -c -o engine-testing.bin ./client/internal - - - name: Generate Peer Test bin - run: CGO_ENABLED=0 go test -c -o peer-testing.bin ./client/internal/peer/... - - - run: chmod +x *testing.bin - - - name: Run Shared Sock tests in docker - run: docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/sharedsock --entrypoint /busybox/sh gcr.io/distroless/base:debug -c /ci/sharedsock-testing.bin -test.timeout 5m -test.parallel 1 - - - name: Run Iface tests in docker - run: docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/iface --entrypoint /busybox/sh gcr.io/distroless/base:debug -c /ci/iface-testing.bin -test.timeout 5m -test.parallel 1 - - - name: Run RouteManager tests in docker - run: docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal/routemanager --entrypoint /busybox/sh gcr.io/distroless/base:debug -c /ci/routemanager-testing.bin -test.timeout 5m -test.parallel 1 - - - name: Run SystemOps tests in docker - run: docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal/routemanager/systemops --entrypoint /busybox/sh gcr.io/distroless/base:debug -c /ci/systemops-testing.bin -test.timeout 5m -test.parallel 1 - - - name: Run nftables Manager tests in docker - run: docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/firewall --entrypoint /busybox/sh gcr.io/distroless/base:debug -c /ci/nftablesmanager-testing.bin -test.timeout 5m -test.parallel 1 - - - name: Run Engine tests in docker with file store - run: docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal -e NETBIRD_STORE_ENGINE="jsonfile" --entrypoint /busybox/sh gcr.io/distroless/base:debug -c /ci/engine-testing.bin -test.timeout 5m -test.parallel 1 - - - name: Run Engine tests in docker with sqlite store - run: docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal -e NETBIRD_STORE_ENGINE="sqlite" --entrypoint /busybox/sh gcr.io/distroless/base:debug -c /ci/engine-testing.bin -test.timeout 5m -test.parallel 1 - - - name: Run Peer tests in docker - run: docker run -t --cap-add=NET_ADMIN --privileged --rm -v $PWD:/ci -w /ci/client/internal/peer --entrypoint /busybox/sh gcr.io/distroless/base:debug -c /ci/peer-testing.bin -test.timeout 5m -test.parallel 1 \ No newline at end of file diff --git a/.github/workflows/golang-test-windows.yml b/.github/workflows/golang-test-windows.yml deleted file mode 100644 index 2d63acbcd..000000000 --- a/.github/workflows/golang-test-windows.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Test Code Windows - -on: - push: - branches: - - main - pull_request: - -env: - downloadPath: '${{ github.workspace }}\temp' -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - test: - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install Go - uses: actions/setup-go@v4 - id: go - with: - go-version: "1.21.x" - - - name: Download wintun - uses: carlosperate/download-file-action@v2 - id: download-wintun - with: - file-url: https://pkgs.netbird.io/wintun/wintun-0.14.1.zip - file-name: wintun.zip - location: ${{ env.downloadPath }} - sha256: '07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51' - - - name: Decompressing wintun files - run: tar -zvxf "${{ steps.download-wintun.outputs.file-path }}" -C ${{ env.downloadPath }} - - - run: mv ${{ env.downloadPath }}/wintun/bin/amd64/wintun.dll 'C:\Windows\System32\' - - - run: choco install -y sysinternals --ignore-checksums - - run: choco install -y mingw - - - run: PsExec64 -s -w ${{ github.workspace }} C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe env -w GOMODCACHE=C:\Users\runneradmin\go\pkg\mod - - run: PsExec64 -s -w ${{ github.workspace }} C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe env -w GOCACHE=C:\Users\runneradmin\AppData\Local\go-build - - - name: test - run: PsExec64 -s -w ${{ github.workspace }} cmd.exe /c "C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe test -timeout 10m -p 1 ./... > test-out.txt 2>&1" - - name: test output - if: ${{ always() }} - run: Get-Content test-out.txt diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml deleted file mode 100644 index 78b9f504f..000000000 --- a/.github/workflows/golangci-lint.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: golangci-lint -on: [pull_request] - -permissions: - contents: read - pull-requests: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - codespell: - name: codespell - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: codespell - uses: codespell-project/actions-codespell@v2 - with: - ignore_words_list: erro,clienta,hastable, - skip: go.mod,go.sum - only_warn: 1 - golangci: - strategy: - fail-fast: false - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] - name: lint - runs-on: ${{ matrix.os }} - timeout-minutes: 15 - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Check for duplicate constants - if: matrix.os == 'ubuntu-latest' - run: | - ! awk '/const \(/,/)/{print $0}' management/server/activity/codes.go | grep -o '= [0-9]*' | sort | uniq -d | grep . - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: "1.21.x" - cache: false - - name: Install dependencies - if: matrix.os == 'ubuntu-latest' - run: sudo apt update && sudo apt install -y -q libgtk-3-dev libayatana-appindicator3-dev libgl1-mesa-dev xorg-dev libpcap-dev - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: latest - args: --timeout=12m \ No newline at end of file diff --git a/.github/workflows/install-script-test.yml b/.github/workflows/install-script-test.yml deleted file mode 100644 index dfb8a279b..000000000 --- a/.github/workflows/install-script-test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Test installation - -on: - push: - branches: - - main - pull_request: - paths: - - "release_files/install.sh" -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true -jobs: - test-install-script: - strategy: - max-parallel: 2 - matrix: - os: [ubuntu-latest, macos-latest] - skip_ui_mode: [true, false] - install_binary: [true, false] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: run install script - env: - SKIP_UI_APP: ${{ matrix.skip_ui_mode }} - USE_BIN_INSTALL: ${{ matrix.install_binary }} - GITHUB_TOKEN: ${{ secrets.RO_API_CALLER_TOKEN }} - run: | - [ "$SKIP_UI_APP" == "false" ] && export XDG_CURRENT_DESKTOP="none" - cat release_files/install.sh | sh -x - - - name: check cli binary - run: command -v netbird diff --git a/.github/workflows/mobile-build-validation.yml b/.github/workflows/mobile-build-validation.yml deleted file mode 100644 index e5a5ff485..000000000 --- a/.github/workflows/mobile-build-validation.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Mobile build validation - -on: - push: - branches: - - main - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - android_build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: "1.21.x" - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - with: - cmdline-tools-version: 8512546 - - name: Setup Java - uses: actions/setup-java@v3 - with: - java-version: "11" - distribution: "adopt" - - name: NDK Cache - id: ndk-cache - uses: actions/cache@v3 - with: - path: /usr/local/lib/android/sdk/ndk - key: ndk-cache-23.1.7779620 - - name: Setup NDK - run: /usr/local/lib/android/sdk/cmdline-tools/7.0/bin/sdkmanager --install "ndk;23.1.7779620" - - name: install gomobile - run: go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20240404231514-09dbf07665ed - - name: gomobile init - run: gomobile init - - name: build android netbird lib - run: PATH=$PATH:$(go env GOPATH) gomobile bind -o $GITHUB_WORKSPACE/netbird.aar -javapkg=io.netbird.gomobile -ldflags="-X golang.zx2c4.com/wireguard/ipc.socketDirectory=/data/data/io.netbird.client/cache/wireguard -X github.com/netbirdio/netbird/version.version=buildtest" $GITHUB_WORKSPACE/client/android - env: - CGO_ENABLED: 0 - ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/23.1.7779620 - ios_build: - runs-on: macos-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: "1.21.x" - - name: install gomobile - run: go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20240404231514-09dbf07665ed - - name: gomobile init - run: gomobile init - - name: build iOS netbird lib - run: PATH=$PATH:$(go env GOPATH) gomobile bind -target=ios -bundleid=io.netbird.framework -ldflags="-X github.com/netbirdio/netbird/version.version=buildtest" -o ./NetBirdSDK.xcframework ./client/ios/NetBirdSDK - env: - CGO_ENABLED: 0 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 30f24e92e..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,260 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v*' - branches: - - main - pull_request: - - -env: - SIGN_PIPE_VER: "v0.0.12" - GORELEASER_VER: "v1.14.1" - PRODUCT_NAME: "NetBird" - COPYRIGHT: "Wiretrustee UG (haftungsbeschreankt)" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - release: - runs-on: ubuntu-latest - env: - flags: "" - steps: - - name: Parse semver string - id: semver_parser - uses: booxmedialtd/ws-action-parse-semver@v1 - with: - input_string: ${{ (startsWith(github.ref, 'refs/tags/v') && github.ref) || 'refs/tags/v0.0.0' }} - version_extractor_regex: '\/v(.*)$' - - - if: ${{ !startsWith(github.ref, 'refs/tags/v') }} - run: echo "flags=--snapshot" >> $GITHUB_ENV - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 # It is required for GoReleaser to work properly - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.21" - cache: false - - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-go-releaser-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-releaser- - - - name: Install modules - run: go mod tidy - - - name: check git status - run: git --no-pager diff --exit-code - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Docker hub - if: github.event_name != 'pull_request' - uses: docker/login-action@v1 - with: - username: netbirdio - password: ${{ secrets.DOCKER_TOKEN }} - - name: Install OS build dependencies - run: sudo apt update && sudo apt install -y -q gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu - - - name: Install goversioninfo - run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e - - name: Generate windows syso amd64 - run: goversioninfo -icon client/ui/netbird.ico -manifest client/manifest.xml -product-name ${{ env.PRODUCT_NAME }} -copyright "${{ env.COPYRIGHT }}" -ver-major ${{ steps.semver_parser.outputs.major }} -ver-minor ${{ steps.semver_parser.outputs.minor }} -ver-patch ${{ steps.semver_parser.outputs.patch }} -ver-build 0 -file-version ${{ steps.semver_parser.outputs.fullversion }}.0 -product-version ${{ steps.semver_parser.outputs.fullversion }}.0 -o client/resources_windows_amd64.syso - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 - with: - version: ${{ env.GORELEASER_VER }} - args: release --rm-dist ${{ env.flags }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} - UPLOAD_DEBIAN_SECRET: ${{ secrets.PKG_UPLOAD_SECRET }} - UPLOAD_YUM_SECRET: ${{ secrets.PKG_UPLOAD_SECRET }} - - - name: upload non tags for debug purposes - uses: actions/upload-artifact@v3 - with: - name: release - path: dist/ - retention-days: 3 - - - name: upload linux packages - uses: actions/upload-artifact@v3 - with: - name: linux-packages - path: dist/netbird_linux** - retention-days: 3 - - - name: upload windows packages - uses: actions/upload-artifact@v3 - with: - name: windows-packages - path: dist/netbird_windows** - retention-days: 3 - - - name: upload macos packages - uses: actions/upload-artifact@v3 - with: - name: macos-packages - path: dist/netbird_darwin** - retention-days: 3 - - release_ui: - runs-on: ubuntu-latest - steps: - - name: Parse semver string - id: semver_parser - uses: booxmedialtd/ws-action-parse-semver@v1 - with: - input_string: ${{ (startsWith(github.ref, 'refs/tags/v') && github.ref) || 'refs/tags/v0.0.0' }} - version_extractor_regex: '\/v(.*)$' - - - if: ${{ !startsWith(github.ref, 'refs/tags/v') }} - run: echo "flags=--snapshot" >> $GITHUB_ENV - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 # It is required for GoReleaser to work properly - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.21" - cache: false - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-ui-go-releaser-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-ui-go-releaser- - - - name: Install modules - run: go mod tidy - - - name: check git status - run: git --no-pager diff --exit-code - - - name: Install dependencies - run: sudo apt update && sudo apt install -y -q libappindicator3-dev gir1.2-appindicator3-0.1 libxxf86vm-dev gcc-mingw-w64-x86-64 - - name: Install goversioninfo - run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e - - name: Generate windows syso amd64 - run: goversioninfo -64 -icon client/ui/netbird.ico -manifest client/ui/manifest.xml -product-name ${{ env.PRODUCT_NAME }}-"UI" -copyright "${{ env.COPYRIGHT }}" -ver-major ${{ steps.semver_parser.outputs.major }} -ver-minor ${{ steps.semver_parser.outputs.minor }} -ver-patch ${{ steps.semver_parser.outputs.patch }} -ver-build 0 -file-version ${{ steps.semver_parser.outputs.fullversion }}.0 -product-version ${{ steps.semver_parser.outputs.fullversion }}.0 -o client/ui/resources_windows_amd64.syso - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 - with: - version: ${{ env.GORELEASER_VER }} - args: release --config .goreleaser_ui.yaml --rm-dist ${{ env.flags }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} - UPLOAD_DEBIAN_SECRET: ${{ secrets.PKG_UPLOAD_SECRET }} - UPLOAD_YUM_SECRET: ${{ secrets.PKG_UPLOAD_SECRET }} - - name: upload non tags for debug purposes - uses: actions/upload-artifact@v3 - with: - name: release-ui - path: dist/ - retention-days: 3 - - release_ui_darwin: - runs-on: macos-latest - steps: - - if: ${{ !startsWith(github.ref, 'refs/tags/v') }} - run: echo "flags=--snapshot" >> $GITHUB_ENV - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 # It is required for GoReleaser to work properly - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.21" - cache: false - - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-ui-go-releaser-darwin-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-ui-go-releaser-darwin- - - - name: Install modules - run: go mod tidy - - - name: check git status - run: git --no-pager diff --exit-code - - - name: Run GoReleaser - id: goreleaser - uses: goreleaser/goreleaser-action@v4 - with: - version: ${{ env.GORELEASER_VER }} - args: release --config .goreleaser_ui_darwin.yaml --rm-dist ${{ env.flags }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: upload non tags for debug purposes - uses: actions/upload-artifact@v3 - with: - name: release-ui-darwin - path: dist/ - retention-days: 3 - - trigger_windows_signer: - runs-on: ubuntu-latest - needs: [release,release_ui] - if: startsWith(github.ref, 'refs/tags/') - steps: - - name: Trigger Windows binaries sign pipeline - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: Sign windows bin and installer - repo: netbirdio/sign-pipelines - ref: ${{ env.SIGN_PIPE_VER }} - token: ${{ secrets.SIGN_GITHUB_TOKEN }} - inputs: '{ "tag": "${{ github.ref }}" }' - - trigger_darwin_signer: - runs-on: ubuntu-latest - needs: [release,release_ui_darwin] - if: startsWith(github.ref, 'refs/tags/') - steps: - - name: Trigger Darwin App binaries sign pipeline - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: Sign darwin ui app with dispatch - repo: netbirdio/sign-pipelines - ref: ${{ env.SIGN_PIPE_VER }} - token: ${{ secrets.SIGN_GITHUB_TOKEN }} - inputs: '{ "tag": "${{ github.ref }}" }' diff --git a/.github/workflows/sync-main.yml b/.github/workflows/sync-main.yml deleted file mode 100644 index e36e35a2d..000000000 --- a/.github/workflows/sync-main.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: sync main - -on: - push: - branches: - - main - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - trigger_sync_main: - runs-on: ubuntu-latest - steps: - - name: Trigger main branch sync - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: sync-main.yml - repo: ${{ secrets.UPSTREAM_REPO }} - token: ${{ secrets.NC_GITHUB_TOKEN }} - inputs: '{ "sha": "${{ github.sha }}" }' \ No newline at end of file diff --git a/.github/workflows/sync-tag.yml b/.github/workflows/sync-tag.yml deleted file mode 100644 index 1cc553b12..000000000 --- a/.github/workflows/sync-tag.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: sync tag - -on: - push: - tags: - - 'v*' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - trigger_sync_tag: - runs-on: ubuntu-latest - steps: - - name: Trigger release tag sync - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: sync-tag.yml - ref: main - repo: ${{ secrets.UPSTREAM_REPO }} - token: ${{ secrets.NC_GITHUB_TOKEN }} - inputs: '{ "tag": "${{ github.ref_name }}" }' \ No newline at end of file diff --git a/.github/workflows/test-infrastructure-files.yml b/.github/workflows/test-infrastructure-files.yml deleted file mode 100644 index 52b8ee3e2..000000000 --- a/.github/workflows/test-infrastructure-files.yml +++ /dev/null @@ -1,256 +0,0 @@ -name: Test Infrastructure files - -on: - push: - branches: - - main - pull_request: - paths: - - 'infrastructure_files/**' - - '.github/workflows/test-infrastructure-files.yml' - - 'management/cmd/**' - - 'signal/cmd/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }} - cancel-in-progress: true - -jobs: - test-docker-compose: - runs-on: ubuntu-latest - steps: - - name: Install jq - run: sudo apt-get install -y jq - - - name: Install curl - run: sudo apt-get install -y curl - - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: "1.21.x" - - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Checkout code - uses: actions/checkout@v3 - - - name: cp setup.env - run: cp infrastructure_files/tests/setup.env infrastructure_files/ - - - name: run configure - working-directory: infrastructure_files - run: bash -x configure.sh - env: - CI_NETBIRD_DOMAIN: localhost - CI_NETBIRD_AUTH_CLIENT_ID: testing.client.id - CI_NETBIRD_AUTH_CLIENT_SECRET: testing.client.secret - CI_NETBIRD_AUTH_AUDIENCE: testing.ci - CI_NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT: https://example.eu.auth0.com/.well-known/openid-configuration - CI_NETBIRD_USE_AUTH0: true - CI_NETBIRD_MGMT_IDP: "none" - CI_NETBIRD_IDP_MGMT_CLIENT_ID: testing.client.id - CI_NETBIRD_IDP_MGMT_CLIENT_SECRET: testing.client.secret - CI_NETBIRD_AUTH_SUPPORTED_SCOPES: "openid profile email offline_access api email_verified" - CI_NETBIRD_STORE_CONFIG_ENGINE: "sqlite" - CI_NETBIRD_MGMT_IDP_SIGNKEY_REFRESH: false - - - name: check values - working-directory: infrastructure_files/artifacts - env: - CI_NETBIRD_DOMAIN: localhost - CI_NETBIRD_AUTH_CLIENT_ID: testing.client.id - CI_NETBIRD_AUTH_CLIENT_SECRET: testing.client.secret - CI_NETBIRD_AUTH_AUDIENCE: testing.ci - CI_NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT: https://example.eu.auth0.com/.well-known/openid-configuration - CI_NETBIRD_USE_AUTH0: true - CI_NETBIRD_AUTH_SUPPORTED_SCOPES: "openid profile email offline_access api email_verified" - CI_NETBIRD_AUTH_AUTHORITY: https://example.eu.auth0.com/ - CI_NETBIRD_AUTH_JWT_CERTS: https://example.eu.auth0.com/.well-known/jwks.json - CI_NETBIRD_AUTH_TOKEN_ENDPOINT: https://example.eu.auth0.com/oauth/token - CI_NETBIRD_AUTH_DEVICE_AUTH_ENDPOINT: https://example.eu.auth0.com/oauth/device/code - CI_NETBIRD_AUTH_PKCE_AUTHORIZATION_ENDPOINT: https://example.eu.auth0.com/authorize - CI_NETBIRD_AUTH_REDIRECT_URI: "/peers" - CI_NETBIRD_TOKEN_SOURCE: "idToken" - CI_NETBIRD_AUTH_USER_ID_CLAIM: "email" - CI_NETBIRD_AUTH_DEVICE_AUTH_AUDIENCE: "super" - CI_NETBIRD_AUTH_DEVICE_AUTH_SCOPE: "openid email" - CI_NETBIRD_MGMT_IDP: "none" - CI_NETBIRD_IDP_MGMT_CLIENT_ID: testing.client.id - CI_NETBIRD_IDP_MGMT_CLIENT_SECRET: testing.client.secret - CI_NETBIRD_SIGNAL_PORT: 12345 - CI_NETBIRD_STORE_CONFIG_ENGINE: "sqlite" - CI_NETBIRD_MGMT_IDP_SIGNKEY_REFRESH: false - CI_NETBIRD_TURN_EXTERNAL_IP: "1.2.3.4" - - run: | - set -x - grep AUTH_CLIENT_ID docker-compose.yml | grep $CI_NETBIRD_AUTH_CLIENT_ID - grep AUTH_CLIENT_SECRET docker-compose.yml | grep $CI_NETBIRD_AUTH_CLIENT_SECRET - grep AUTH_AUTHORITY docker-compose.yml | grep $CI_NETBIRD_AUTH_AUTHORITY - grep AUTH_AUDIENCE docker-compose.yml | grep $CI_NETBIRD_AUTH_AUDIENCE - grep AUTH_SUPPORTED_SCOPES docker-compose.yml | grep "$CI_NETBIRD_AUTH_SUPPORTED_SCOPES" - grep USE_AUTH0 docker-compose.yml | grep $CI_NETBIRD_USE_AUTH0 - grep NETBIRD_MGMT_API_ENDPOINT docker-compose.yml | grep "$CI_NETBIRD_DOMAIN:33073" - grep AUTH_REDIRECT_URI docker-compose.yml | grep $CI_NETBIRD_AUTH_REDIRECT_URI - grep AUTH_SILENT_REDIRECT_URI docker-compose.yml | egrep 'AUTH_SILENT_REDIRECT_URI=$' - grep $CI_NETBIRD_SIGNAL_PORT docker-compose.yml | grep ':80' - grep LETSENCRYPT_DOMAIN docker-compose.yml | egrep 'LETSENCRYPT_DOMAIN=$' - grep NETBIRD_TOKEN_SOURCE docker-compose.yml | grep $CI_NETBIRD_TOKEN_SOURCE - grep AuthUserIDClaim management.json | grep $CI_NETBIRD_AUTH_USER_ID_CLAIM - grep -A 3 DeviceAuthorizationFlow management.json | grep -A 1 ProviderConfig | grep Audience | grep $CI_NETBIRD_AUTH_DEVICE_AUTH_AUDIENCE - grep -A 3 DeviceAuthorizationFlow management.json | grep -A 1 ProviderConfig | grep Audience | grep $CI_NETBIRD_AUTH_DEVICE_AUTH_AUDIENCE - grep Engine management.json | grep "$CI_NETBIRD_STORE_CONFIG_ENGINE" - grep IdpSignKeyRefreshEnabled management.json | grep "$CI_NETBIRD_MGMT_IDP_SIGNKEY_REFRESH" - grep UseIDToken management.json | grep false - grep -A 1 IdpManagerConfig management.json | grep ManagerType | grep $CI_NETBIRD_MGMT_IDP - grep -A 3 IdpManagerConfig management.json | grep -A 1 ClientConfig | grep Issuer | grep $CI_NETBIRD_AUTH_AUTHORITY - grep -A 4 IdpManagerConfig management.json | grep -A 2 ClientConfig | grep TokenEndpoint | grep $CI_NETBIRD_AUTH_TOKEN_ENDPOINT - grep -A 5 IdpManagerConfig management.json | grep -A 3 ClientConfig | grep ClientID | grep $CI_NETBIRD_IDP_MGMT_CLIENT_ID - grep -A 6 IdpManagerConfig management.json | grep -A 4 ClientConfig | grep ClientSecret | grep $CI_NETBIRD_IDP_MGMT_CLIENT_SECRET - grep -A 7 IdpManagerConfig management.json | grep -A 5 ClientConfig | grep GrantType | grep client_credentials - grep -A 10 PKCEAuthorizationFlow management.json | grep -A 10 ProviderConfig | grep Audience | grep $CI_NETBIRD_AUTH_AUDIENCE - grep -A 10 PKCEAuthorizationFlow management.json | grep -A 10 ProviderConfig | grep ClientID | grep $CI_NETBIRD_AUTH_CLIENT_ID - grep -A 10 PKCEAuthorizationFlow management.json | grep -A 10 ProviderConfig | grep ClientSecret | grep $CI_NETBIRD_AUTH_CLIENT_SECRET - grep -A 10 PKCEAuthorizationFlow management.json | grep -A 10 ProviderConfig | grep AuthorizationEndpoint | grep $CI_NETBIRD_AUTH_PKCE_AUTHORIZATION_ENDPOINT - grep -A 10 PKCEAuthorizationFlow management.json | grep -A 10 ProviderConfig | grep TokenEndpoint | grep $CI_NETBIRD_AUTH_TOKEN_ENDPOINT - grep -A 10 PKCEAuthorizationFlow management.json | grep -A 10 ProviderConfig | grep Scope | grep "$CI_NETBIRD_AUTH_SUPPORTED_SCOPES" - grep -A 10 PKCEAuthorizationFlow management.json | grep -A 10 ProviderConfig | grep -A 3 RedirectURLs | grep "http://localhost:53000" - grep "external-ip" turnserver.conf | grep $CI_NETBIRD_TURN_EXTERNAL_IP - - - name: Install modules - run: go mod tidy - - - name: check git status - run: git --no-pager diff --exit-code - - - name: Build management binary - working-directory: management - run: CGO_ENABLED=1 go build -o netbird-mgmt main.go - - - name: Build management docker image - working-directory: management - run: | - docker build -t netbirdio/management:latest . - - - name: Build signal binary - working-directory: signal - run: CGO_ENABLED=0 go build -o netbird-signal main.go - - - name: Build signal docker image - working-directory: signal - run: | - docker build -t netbirdio/signal:latest . - - - name: run docker compose up - working-directory: infrastructure_files/artifacts - run: | - docker compose up -d - sleep 5 - docker compose ps - docker compose logs --tail=20 - - - name: test running containers - run: | - count=$(docker compose ps --format json | jq '. | select(.Name | contains("artifacts")) | .State' | grep -c running) - test $count -eq 4 - working-directory: infrastructure_files/artifacts - - - name: test geolocation databases - working-directory: infrastructure_files/artifacts - run: | - sleep 30 - docker compose exec management ls -l /var/lib/netbird/ | grep -i GeoLite2-City.mmdb - docker compose exec management ls -l /var/lib/netbird/ | grep -i geonames.db - - test-getting-started-script: - runs-on: ubuntu-latest - steps: - - name: Install jq - run: sudo apt-get install -y jq - - - name: Checkout code - uses: actions/checkout@v3 - - - name: run script with Zitadel PostgreSQL - run: NETBIRD_DOMAIN=use-ip bash -x infrastructure_files/getting-started-with-zitadel.sh - - - name: test Caddy file gen postgres - run: test -f Caddyfile - - - name: test docker-compose file gen postgres - run: test -f docker-compose.yml - - - name: test management.json file gen postgres - run: test -f management.json - - - name: test turnserver.conf file gen postgres - run: | - set -x - test -f turnserver.conf - grep external-ip turnserver.conf - - - name: test zitadel.env file gen postgres - run: test -f zitadel.env - - - name: test dashboard.env file gen postgres - run: test -f dashboard.env - - - name: test zdb.env file gen postgres - run: test -f zdb.env - - - name: Postgres run cleanup - run: | - docker compose down --volumes --rmi all - rm -rf docker-compose.yml Caddyfile zitadel.env dashboard.env machinekey/zitadel-admin-sa.token turnserver.conf management.json zdb.env - - - name: run script with Zitadel CockroachDB - run: bash -x infrastructure_files/getting-started-with-zitadel.sh - env: - NETBIRD_DOMAIN: use-ip - ZITADEL_DATABASE: cockroach - - - name: test Caddy file gen CockroachDB - run: test -f Caddyfile - - - name: test docker-compose file gen CockroachDB - run: test -f docker-compose.yml - - - name: test management.json file gen CockroachDB - run: test -f management.json - - - name: test turnserver.conf file gen CockroachDB - run: | - set -x - test -f turnserver.conf - grep external-ip turnserver.conf - - - name: test zitadel.env file gen CockroachDB - run: test -f zitadel.env - - - name: test dashboard.env file gen CockroachDB - run: test -f dashboard.env - - test-download-geolite2-script: - runs-on: ubuntu-latest - steps: - - name: Install jq - run: sudo apt-get update && sudo apt-get install -y unzip sqlite3 - - - name: Checkout code - uses: actions/checkout@v3 - - - name: test script - run: bash -x infrastructure_files/download-geolite2.sh - - - name: test mmdb file exists - run: test -f GeoLite2-City.mmdb - - - name: test geonames file exists - run: test -f geonames.db diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml deleted file mode 100644 index 77096790f..000000000 --- a/.github/workflows/update-docs.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: update docs - -on: - push: - tags: - - 'v*' - paths: - - 'management/server/http/api/openapi.yml' - -jobs: - trigger_docs_api_update: - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - steps: - - name: Trigger API pages generation - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: generate api pages - repo: netbirdio/docs - ref: "refs/heads/main" - token: ${{ secrets.SIGN_GITHUB_TOKEN }} - inputs: '{ "tag": "${{ github.ref }}" }' \ No newline at end of file