|
1 |
| -on: [push] |
| 1 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go |
| 2 | +on: |
| 3 | + # Run CI when pushing to main |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + # Run CI for PRs to main and staging |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + workflow_dispatch: |
2 | 10 | jobs:
|
3 |
| - go-build: |
| 11 | + build: |
4 | 12 | runs-on: ubuntu-latest
|
5 | 13 | strategy:
|
6 | 14 | matrix:
|
7 |
| - go: ["1.14", "1.13", "1.12"] |
| 15 | + go: ["1.18", "1.17", "1.16"] |
8 | 16 | steps:
|
9 | 17 |
|
10 |
| - - uses: actions/setup-go@v2 |
| 18 | + - uses: actions/setup-node@v3 |
| 19 | + with: |
| 20 | + node-version: current |
| 21 | + - uses: actions/setup-go@v3 |
11 | 22 | with:
|
12 | 23 | go-version: ${{ matrix.go }}
|
13 |
| - - run: go build -x -work ./cmds/... |
14 |
| - node-build: |
| 24 | + - run: make |
| 25 | + docker-build: |
| 26 | + name: Create docker image |
15 | 27 | runs-on: ubuntu-latest
|
16 | 28 | steps:
|
17 | 29 |
|
18 |
| - - uses: actions/setup-node@v1 |
| 30 | + - name: Prepare |
| 31 | + id: prep |
| 32 | + run: | |
| 33 | + DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/hound |
| 34 | + VERSION=latest |
| 35 | + if [[ $GITHUB_REF == refs/tags/* ]]; then |
| 36 | + VERSION=${GITHUB_REF#refs/tags/v} |
| 37 | + fi |
| 38 | + TAGS="${DOCKER_IMAGE}:${VERSION}" |
| 39 | + if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then |
| 40 | + TAGS="$TAGS,${DOCKER_IMAGE}:latest" |
| 41 | + fi |
| 42 | + echo ::set-output name=tags::${TAGS} |
| 43 | + - name: Set up QEMU |
| 44 | + uses: docker/setup-qemu-action@v1 |
| 45 | + - name: Set up Docker Buildx |
| 46 | + uses: docker/setup-buildx-action@v1 |
| 47 | + - name: Login to GitHub Packages Docker Registry |
| 48 | + uses: docker/login-action@v1 |
| 49 | + with: |
| 50 | + registry: ghcr.io |
| 51 | + username: ${{ github.actor }} |
| 52 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + - name: Push to GitHub Packages |
| 54 | + uses: docker/build-push-action@v2 |
19 | 55 | with:
|
20 |
| - node-version: "10.x" |
21 |
| - - run: npm install |
| 56 | + context: . |
| 57 | + platforms: linux/amd64,linux/arm64 |
| 58 | + file: ./Dockerfile |
| 59 | + push: true |
| 60 | + tags: ${{ steps.prep.outputs.tags }} |
22 | 61 | golangci:
|
23 | 62 | name: lint
|
24 | 63 | strategy:
|
25 | 64 | matrix:
|
26 |
| - go: ["1.14"] |
| 65 | + go: ["1.18"] |
27 | 66 | os: [ubuntu-latest]
|
28 | 67 | runs-on: ${{ matrix.os }}
|
29 | 68 | steps:
|
30 |
| - |
| 69 | + - uses: actions/checkout@v3 |
| 70 | + - uses: actions/setup-node@v3 |
| 71 | + with: |
| 72 | + node-version: current |
| 73 | + - run: make ui |
| 74 | + - uses: actions/setup-go@v3 |
| 75 | + with: |
| 76 | + go-version: ${{ matrix.go }} |
31 | 77 | - name: golangci-lint
|
32 |
| - uses: golangci/golangci-lint-action@v2.3.0 |
| 78 | + uses: golangci/golangci-lint-action@v3 |
33 | 79 | with:
|
34 |
| - # the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. |
35 |
| - version: v1.35.2 |
36 |
| - go-test: |
| 80 | + version: v1.46.2 |
| 81 | + |
| 82 | + test: |
37 | 83 | strategy:
|
38 | 84 | matrix:
|
39 |
| - go: ["1.14", "1.13", "1.12"] |
| 85 | + go: ["1.18", "1.17", "1.16"] |
40 | 86 | os: [windows-latest, ubuntu-latest]
|
41 | 87 | runs-on: ${{ matrix.os }}
|
42 | 88 | steps:
|
43 | 89 |
|
44 |
| - - uses: actions/setup-go@v2 |
| 90 | + - uses: actions/setup-node@v3 |
| 91 | + with: |
| 92 | + node-version: current |
| 93 | + - run: make ui |
| 94 | + - uses: actions/setup-go@v3 |
45 | 95 | with:
|
46 | 96 | go-version: ${{ matrix.go }}
|
47 | 97 | - run: go test -race ./...
|
|
0 commit comments