github.com/vicanso/pike@v1.0.1-0.20210630235453-9099e041f6ec/.github/workflows/test.yml (about) 1 name: lint and test 2 3 on: 4 push: 5 branches: [ master ] 6 pull_request: 7 branches: [ master ] 8 9 jobs: 10 test: 11 name: Test 12 runs-on: ubuntu-latest 13 services: 14 etcd: 15 image: bitnami/etcd 16 env: 17 ETCD_ROOT_PASSWORD: 123456 18 ports: 19 - 2379:2379 20 redis: 21 # Docker Hub image 22 image: redis 23 # Set health checks to wait until redis has started 24 options: >- 25 --health-cmd "redis-cli ping" 26 --health-interval 10s 27 --health-timeout 5s 28 --health-retries 5 29 ports: 30 # Maps port 6379 on service container to the host 31 - 6379:6379 32 mongo: 33 image: mongo 34 ports: 35 - 27017:27017 36 37 steps: 38 39 - name: Build pike 40 uses: actions/setup-go@v2 41 with: 42 go-version: '1.16' 43 44 - name: Check out code into the Go module directory 45 uses: actions/checkout@v2 46 47 - name: Get dependencies 48 run: 49 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest 50 51 - name: Lint 52 run: make lint 53 54 - name: Test 55 run: make test 56 57 build: 58 needs: test 59 runs-on: ubuntu-latest 60 name: Build 61 steps: 62 - name: Check out code into the Go module directory 63 uses: actions/checkout@v2 64 - name: Set up QEMU 65 uses: docker/setup-qemu-action@v1 66 - name: Set up Docker Buildx 67 uses: docker/setup-buildx-action@v1 68 - name: Login to Docker Hub 69 uses: docker/login-action@v1 70 with: 71 username: ${{ secrets.DOCKER_HUB_USERNAME }} 72 password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} 73 - name: Build and push 74 id: docker_build 75 uses: docker/build-push-action@v2 76 with: 77 push: true 78 tags: ${{ secrets.DOCKER_HUB_USERNAME }}/pike:latest 79 build-args: GITHUB_SHA=${ GITHUB_SHA } 80 - name: Image digest 81 run: echo ${{ steps.docker_build.outputs.digest }}