github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/.github/workflows/integration-helm.yaml (about)

     1  name: Kubernetes profile
     2  on: [push]
     3  
     4  jobs:
     5    test:
     6      name: Integration tests
     7      runs-on: ubuntu-latest
     8      env:
     9        DOCKER_BUILDKIT: "1"
    10      steps:
    11        - name: Checkout
    12          uses: actions/checkout@v1
    13        - name: Set up Go 1.16
    14          uses: actions/setup-go@v2
    15          with:
    16            go-version: 1.16
    17          id: go
    18        - name: Install Protoc
    19          uses: arduino/setup-protoc@master
    20  
    21        # http://man7.org/linux/man-pages/man1/date.1.html
    22        - name: Get Date
    23          id: get-date
    24          run: |
    25            echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
    26          shell: bash
    27        - name: Enable caching
    28          uses: actions/cache@v2
    29          with:
    30            path: ~/go/pkg/mod
    31            key: ${{ runner.os }}-go-kind-${{ steps.get-date.outputs.date }}
    32  
    33        # We set up a local docker registry to push to and pull from. We need to set up the Kind cluster to pull from this
    34        # We don't currently cache this because it doesn't seem to speed up the build
    35        - name: Setup docker registry
    36          run: |
    37            docker run -d -p 5000:5000 --restart=always --name kind-registry -v /tmp/docker-registry:/var/lib/registry registry:2 && npx wait-on tcp:5000
    38  
    39        - name: Build and push micro to local registry
    40          id: build-push-reg-micro
    41          run: |
    42            GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
    43            docker build -f ./test/Dockerfile . -t localhost:5000/micro 
    44            docker push localhost:5000/micro
    45  
    46        - name: Build and push cells to local registry
    47          id: build-push-reg-cell
    48          run: |
    49            DIR=service/runtime/cells/v3
    50            docker build -f $DIR/Dockerfile $DIR -t localhost:5000/cells:v3
    51            docker push localhost:5000/cells:v3
    52  
    53        - name: Setup Kind
    54          uses: engineerd/setup-kind@v0.5.0
    55          with:
    56            config: scripts/kind/kind-config.yaml
    57            version: v0.8.1
    58  
    59        - name: Finish Kind registry setup
    60          run: |
    61            docker network connect "kind" "kind-registry"
    62            for node in $(kind get nodes); do kubectl annotate node "${node}" "kind.x-k8s.io/registry=localhost:5000"; done
    63  
    64        - name: Install the platform
    65          run: |
    66            helm repo add micro https://micro.github.io/helm
    67            helm install micro micro/micro --set image.repo=localhost:5000/micro
    68            kubectl wait job --all --for=condition=complete -n micro --timeout=120s
    69            kubectl wait deployment --all --for=condition=available -n micro --timeout=120s
    70  
    71        - name: Install failed, show platform logs
    72          if: ${{ failure() }}
    73          run: |
    74            kubectl get pods -n micro | awk '{print $1}' | xargs -n1 kubectl logs -n micro
    75  
    76        - name: Install micro
    77          run: go install
    78  
    79        # Finally, we can actually run the tests
    80        - name: Test micro server
    81          working-directory: ./test
    82          env:
    83            IN_TRAVIS_CI: yes
    84            IN_HELM_TEST: yes
    85            GITHUB_PAT: ${{ secrets.MICRO_ACTIONS_PAT }}
    86          run: |
    87            go clean -testcache && GOMAXPROCS=4 go test --tags=integration,kind -v -run ./... -timeout 20m