build.yml 1.26 KB
Newer Older
1
2
3
4
5
6
7
8
on:
  push:
    branches:
      - "*"
  pull_request:
    types: [opened, synchronize, reopened]
name: Main Workflow
jobs:
Nicolas Pernoud's avatar
Nicolas Pernoud committed
9
10
  sonarcloud-scan:
    name: Scan with SonarCloud
11
12
    runs-on: ubuntu-latest
    steps:
13
14
15
16
      - name: Install Go
        uses: actions/setup-go@v1
        with:
          go-version: 1.14.x
17
18
19
20
21
      - name: Code Checkout
        uses: actions/checkout@v2
        with:
          # Disabling shallow clone is recommended for improving relevancy of reporting
          fetch-depth: 0
22
23
      - name: Calculate Golang coverage 
        run: go test ./... -coverprofile=coverage.out
24
25
26
27
28
      - name: SonarCloud Scan
        uses: sonarsource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Nicolas Pernoud's avatar
Nicolas Pernoud committed
29
30
31
32
33
34
35
  docker-build:
    name: Build image and push to Docker Hub
    runs-on: ubuntu-latest
    steps:
      - name: Code Checkout
        uses: actions/checkout@v2
      - name: Build image and push to Docker Hub
36
        uses: docker/build-push-action@v1
37
38
        env:
          DOCKER_BUILDKIT: 1
39
40
41
42
43
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
          repository: nicolaspernoud/vestibule
          tag_with_ref: true