on: push: branches: - '**' pull_request: branches: - 'master' jobs: go-test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Golang uses: actions/setup-go@v4 - name: Run frontend unit test run: | export GO111MODULE=on cd frontend go get -v -t -d ./... go test -v ./... cd .. - name: Run proxy unit test run: | export GO111MODULE=on cd proxy go get -v -t -d ./... go test -v ./... cd .. docker-test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Test whois binary in frontend image run: | docker build -t local/frontend frontend/ docker run --rm --net host --entrypoint whois local/frontend github.com || exit 1 docker run --rm --net host --entrypoint whois local/frontend -h whois.ripe.net github.com || exit 1 docker run --rm --net host --entrypoint whois local/frontend -h whois.ripe.net:43 github.com || exit 1 - name: Test traceroute binary in proxy image run: | docker build -t local/proxy proxy/ docker run --rm --net host --entrypoint traceroute local/proxy 127.0.0.1 || exit 1 docker run --rm --net host --entrypoint traceroute local/proxy ::1 || exit 1 docker-develop: runs-on: ubuntu-latest needs: - go-test - docker-test if: github.event_name != 'pull_request' steps: - 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 uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build frontend docker image uses: docker/build-push-action@v4 with: context: '{{defaultContext}}:frontend' platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 push: true tags: | xddxdd/bird-lg-go:develop xddxdd/bird-lg-go:develop-${{ github.sha }} ghcr.io/xddxdd/bird-lg-go:frontend-develop ghcr.io/xddxdd/bird-lg-go:frontend-develop-${{ github.sha }} - name: Build proxy docker image uses: docker/build-push-action@v4 with: context: '{{defaultContext}}:proxy' platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 push: true tags: | xddxdd/bird-lgproxy-go:develop xddxdd/bird-lgproxy-go:develop-${{ github.sha }} ghcr.io/xddxdd/bird-lg-go:proxy-develop ghcr.io/xddxdd/bird-lg-go:proxy-develop-${{ github.sha }}