|
1 |
| -name: Lint and Test Charts |
| 1 | +name: Checks |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
5 | 5 | branches: [master]
|
6 |
| - tags: |
7 |
| - - 'v*' |
8 | 6 | pull_request:
|
9 | 7 |
|
10 | 8 | jobs:
|
11 |
| - docker-build: |
| 9 | + go-tests: |
| 10 | + name: Run tests |
12 | 11 | runs-on: ubuntu-latest
|
13 |
| - name: Building Docker Image |
14 | 12 | steps:
|
15 |
| - - name: Checkout |
16 |
| - uses: actions/checkout@v2 |
17 |
| - |
18 |
| - - name: Docker meta |
19 |
| - id: docker_meta |
20 |
| - uses: docker/metadata-action@v3 |
21 |
| - with: |
22 |
| - images: caddy/ingress |
23 |
| - tags: | |
24 |
| - type=semver,pattern={{raw}} |
25 |
| - type=ref,event=branch |
26 |
| - type=ref,event=pr |
27 |
| - type=sha |
28 |
| -
|
29 |
| - - name: Set up QEMU |
30 |
| - uses: docker/setup-qemu-action@v1 |
31 |
| - |
32 |
| - - name: Set up Docker Buildx |
33 |
| - uses: docker/setup-buildx-action@v1 |
| 13 | + - uses: actions/checkout@v2 |
34 | 14 |
|
35 |
| - - name: Login to DockerHub |
36 |
| - # Forks don't have push access to docker |
37 |
| - if: github.repository == 'caddyserver/ingress' |
38 |
| - uses: docker/login-action@v1 |
| 15 | + - name: Set up Go |
| 16 | + uses: actions/setup-go@v2 |
39 | 17 | with:
|
40 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
41 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
| 18 | + go-version: 1.16 |
42 | 19 |
|
43 |
| - - name: Build and push |
44 |
| - id: docker_build |
45 |
| - uses: docker/build-push-action@v2 |
46 |
| - with: |
47 |
| - push: ${{ github.repository == 'caddyserver/ingress' }} |
48 |
| - tags: ${{ steps.docker_meta.outputs.tags }} |
49 |
| - labels: ${{ steps.docker_meta.outputs.labels }} |
50 |
| - platforms: linux/amd64,linux/arm64 |
51 |
| - cache-from: type=gha |
52 |
| - cache-to: type=gha,mode=max |
| 20 | + - name: Test |
| 21 | + run: go test -v ./... |
53 | 22 |
|
54 |
| - lint-test: |
| 23 | + chart-test-current: |
55 | 24 | name: Test and lint charts
|
56 |
| - needs: |
57 |
| - - docker-build |
58 | 25 | runs-on: ubuntu-latest
|
59 | 26 | steps:
|
60 | 27 | - name: Checkout
|
|
67 | 34 | with:
|
68 | 35 | version: v3.8.1
|
69 | 36 |
|
| 37 | + - name: Set up QEMU |
| 38 | + uses: docker/setup-qemu-action@v1 |
| 39 | + with: |
| 40 | + platforms: arm64 |
| 41 | + |
70 | 42 | - uses: actions/setup-python@v2
|
71 | 43 | with:
|
72 | 44 | python-version: 3.7
|
|
77 | 49 | - name: Run chart-testing (lint)
|
78 | 50 | run: ct lint --config ct.yaml
|
79 | 51 |
|
| 52 | + - name: Run GoReleaser |
| 53 | + uses: goreleaser/goreleaser-action@v2 |
| 54 | + with: |
| 55 | + distribution: goreleaser |
| 56 | + version: latest |
| 57 | + args: release --snapshot --rm-dist |
| 58 | + |
80 | 59 | - name: Create kind cluster
|
81 | 60 |
|
82 | 61 |
|
|
99 | 78 | - 172.17.255.1-172.17.255.200
|
100 | 79 | EOF
|
101 | 80 |
|
102 |
| - - name: Get image tag |
103 |
| - id: image-tag |
104 |
| - run: echo "::set-output name=data::$(echo ${GITHUB_SHA} | cut -c1-7)" |
105 |
| - |
106 |
| - - name: Set current image tag |
107 |
| - working-directory: charts/caddy-ingress-controller |
108 |
| - # Forks don't have push access to docker so don't use it in tests |
109 |
| - if: github.repository == 'caddyserver/ingress' |
110 |
| - run: envsubst < ci/test-values.yaml.tpl > ci/test-values.yaml |
111 |
| - env: |
112 |
| - TAG: ${{ steps.image-tag.outputs.data }} |
| 81 | + - name: Load image into Kind cluster |
| 82 | + run: kind load docker-image "caddy/ingress:test-image" --name chart-testing |
113 | 83 |
|
114 | 84 | - name: Run chart-testing (install)
|
115 | 85 | run: ct install --config ct.yaml
|
0 commit comments