|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - '*' |
| 6 | + tags-ignore: |
| 7 | + - 'v*' |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + - uses: actions/setup-go@v4 |
| 15 | + with: |
| 16 | + go-version-file: go.mod |
| 17 | + check-latest: true |
| 18 | + - uses: subosito/flutter-action@v2 |
| 19 | + with: |
| 20 | + channel: stable |
| 21 | + - name: Run build |
| 22 | + run: | |
| 23 | + make build build_with_tele |
| 24 | + test: |
| 25 | + name: Test |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v3 |
| 29 | + - uses: actions/setup-go@v4 |
| 30 | + with: |
| 31 | + go-version-file: go.mod |
| 32 | + check-latest: true |
| 33 | + - name: Run tests |
| 34 | + run: | |
| 35 | + make test |
| 36 | + vet: |
| 37 | + name: Vet |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v3 |
| 41 | + - uses: actions/setup-go@v4 |
| 42 | + with: |
| 43 | + go-version-file: go.mod |
| 44 | + check-latest: true |
| 45 | + - name: Run vet |
| 46 | + run: | |
| 47 | + make tools |
| 48 | + make vet |
| 49 | + e2etest: |
| 50 | + name: E2Etest |
| 51 | + needs: [build, test, vet] |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v3 |
| 55 | + - uses: actions/setup-go@v4 |
| 56 | + with: |
| 57 | + go-version-file: go.mod |
| 58 | + check-latest: true |
| 59 | + - uses: subosito/flutter-action@v2 |
| 60 | + with: |
| 61 | + channel: stable |
| 62 | + - name: Run e2etest |
| 63 | + run: | |
| 64 | + make tools |
| 65 | + make glm_install |
| 66 | + make e2etest |
| 67 | + docker: |
| 68 | + name: Docker |
| 69 | + needs: [e2etest] |
| 70 | + runs-on: ubuntu-latest |
| 71 | + if: github.ref == 'refs/heads/main' |
| 72 | + steps: |
| 73 | + - uses: actions/checkout@v3 |
| 74 | + |
| 75 | + - name: Generate build meta |
| 76 | + run: | |
| 77 | + echo "build_version=${GITHUB_SHA::6}" >> $GITHUB_ENV |
| 78 | + echo "build_date=$(date '+%Y-%m-%d')" >> $GITHUB_ENV |
| 79 | +
|
| 80 | + - name: Set up Docker Buildx |
| 81 | + uses: docker/setup-buildx-action@v2 |
| 82 | + |
| 83 | + - name: Set up Docker QEMU |
| 84 | + uses: docker/setup-qemu-action@v2 |
| 85 | + with: |
| 86 | + platforms: amd64,arm64 |
| 87 | + |
| 88 | + - name: Login to DockerHub |
| 89 | + uses: docker/login-action@v2 |
| 90 | + with: |
| 91 | + registry: ghcr.io |
| 92 | + username: ${{ github.actor }} |
| 93 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 94 | + |
| 95 | + - name: Docker meta |
| 96 | + id: meta |
| 97 | + uses: docker/metadata-action@v4 |
| 98 | + with: |
| 99 | + images: | |
| 100 | + ghcr.io/guardllamanet/glmmgr |
| 101 | + ghcr.io/guardllamanet/glmmgr-wg |
| 102 | +
|
| 103 | + # build flutter assets |
| 104 | + - uses: subosito/flutter-action@v2 |
| 105 | + with: |
| 106 | + channel: stable |
| 107 | + - name: Run Flutter build |
| 108 | + run: | |
| 109 | + make internal/web/ui/dist/flutter.js |
| 110 | +
|
| 111 | + - name: Docker push |
| 112 | + uses: docker/bake-action@v2 |
| 113 | + with: |
| 114 | + push: true |
| 115 | + pull: true |
| 116 | + targets: all |
| 117 | + files: | |
| 118 | + ./docker-bake.hcl |
| 119 | + ${{ steps.meta.outputs.bake-file }} |
| 120 | + set: | |
| 121 | + mgr.tags=ghcr.io/guardllamanet/glmmgr:main |
| 122 | + wg.tags=ghcr.io/guardllamanet/glmmgr-wg:main |
| 123 | + *.args.BUILD_VERSION=${{ env.build_version }} |
| 124 | + *.args.BUILD_DATE=${{ env.build_date }} |
| 125 | + *.platform=linux/arm64,linux/amd64 |
| 126 | + *.cache-from=type=gha |
| 127 | + *.cache-to=type=gha,mode=max |
| 128 | +
|
| 129 | + installer_test: |
| 130 | + name: Installer Test |
| 131 | + needs: [docker] |
| 132 | + runs-on: ubuntu-latest |
| 133 | + if: github.ref == 'refs/heads/main' |
| 134 | + steps: |
| 135 | + - uses: actions/checkout@v3 |
| 136 | + - uses: actions/setup-go@v4 |
| 137 | + with: |
| 138 | + go-version-file: go.mod |
| 139 | + check-latest: true |
| 140 | + - uses: subosito/flutter-action@v2 |
| 141 | + with: |
| 142 | + channel: stable |
| 143 | + - name: Run installer test |
| 144 | + run: | |
| 145 | + make installer_test |
0 commit comments