fix group name #298
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: false | |
jobs: | |
setup-environment: | |
runs-on: "ubuntu-20.04" | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5.1.0 | |
with: | |
go-version: "1.20.8" | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Cache Tools | |
id: tool-cache | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/go/bin | |
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }} | |
- name: Install Tools | |
if: steps.tool-cache.outputs.cache-hit != 'true' | |
run: make install-tools | |
vet: | |
runs-on: "ubuntu-20.04" | |
needs: | |
- setup-environment | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5.1.0 | |
with: | |
go-version: "1.20.8" | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Vet | |
run: go vet ./... | |
secure: | |
runs-on: "ubuntu-20.04" | |
needs: | |
- setup-environment | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5.1.0 | |
with: | |
go-version: "1.20.8" | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Run Gosec Security Scanner | |
uses: securego/gosec@master | |
with: | |
args: -exclude-dir=internal/tools ./... | |
staticcheck: | |
runs-on: "ubuntu-20.04" | |
needs: | |
- setup-environment | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5.1.0 | |
with: | |
go-version: "1.20.8" | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Cache Tools | |
id: tool-cache | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/go/bin | |
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }} | |
- name: Staticcheck | |
run: make staticcheck | |
lint: | |
runs-on: "ubuntu-20.04" | |
needs: | |
- setup-environment | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5.1.0 | |
with: | |
go-version: "1.20.8" | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Cache Tools | |
id: tool-cache | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/go/bin | |
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }} | |
- name: Lint | |
run: make lint | |
misspell: | |
runs-on: "ubuntu-20.04" | |
needs: | |
- setup-environment | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5.1.0 | |
with: | |
go-version: "1.20.8" | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Cache Tools | |
id: tool-cache | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/go/bin | |
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }} | |
- name: Misspell | |
run: make misspell | |
test: | |
runs-on: "ubuntu-20.04" | |
needs: | |
- setup-environment | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5.1.0 | |
with: | |
go-version: "1.20.8" | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- run: make test | |
build-container-images: | |
runs-on: "ubuntu-20.04" | |
needs: | |
- setup-environment | |
- test | |
- vet | |
- lint | |
- secure | |
- misspell | |
- staticcheck | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5.1.0 | |
with: | |
go-version: "1.20.8" | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Cache Tools | |
id: tool-cache | |
uses: actions/cache@v4 | |
with: | |
path: /home/runner/go/bin | |
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod') }} | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: '3.x' | |
- name: Install Protoc Gen Go | |
run: | | |
curl -OL https://github.com/protocolbuffers/protobuf-go/releases/download/v1.27.1/protoc-gen-go.v1.27.1.linux.amd64.tar.gz | |
tar -xvf protoc-gen-go.v1.27.1.linux.amd64.tar.gz | |
sudo mv protoc-gen-go /usr/bin/protoc-gen-go | |
curl -OL https://github.com/jsirianni/grpc-go/releases/download/v1.39.1-js/protoc-gen-go-grpc | |
sudo chmod +x protoc-gen-go-grpc && sudo mv protoc-gen-go-grpc /usr/bin/protoc-gen-go-grpc | |
- name: Set Image Tag | |
run: echo "GITHUB_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Test GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: "v1.20.0" | |
args: release --skip-publish --rm-dist --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
- name: Scan Binaries | |
run: | | |
find dist/*/app | xargs -I{} chmod +x {} | |
lichen --config=./license.yaml $(find dist/*/app | xargs) | |
# push-container-image: | |
# if: github.ref == 'refs/heads/main' | |
# runs-on: "ubuntu-20.04" | |
# needs: | |
# - scan-go-licenses | |
# strategy: | |
# matrix: | |
# service: | |
# - controller | |
# - discovery | |
# - nameserver | |
# steps: | |
# - name: Checkout Repo | |
# uses: actions/checkout@v4 | |
# - name: Set Image Tag | |
# run: echo "GITHUB_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
# - name: Cache Container Image | |
# uses: observiq/action-docker-layer-caching@main | |
# with: | |
# skip-save: true | |
# filter: reference=ghcr.io/coffee-dns/${{ matrix.service }}-*:${{ env.GITHUB_SHA_SHORT }} | |
# - name: Log in to the Container registry | |
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Push Container Images | |
# run: | | |
# commit_tag=$(git rev-parse --short HEAD) | |
# docker tag ghcr.io/coffee-dns/${{ matrix.service }}-amd64:${commit_tag} ghcr.io/coffee-dns/${{ matrix.service }}-amd64:latest | |
# docker tag ghcr.io/coffee-dns/${{ matrix.service }}-arm64:${commit_tag} ghcr.io/coffee-dns/${{ matrix.service }}-arm64:latest | |
# docker push ghcr.io/coffee-dns/${{ matrix.service }}-amd64:${commit_tag} | |
# docker push ghcr.io/coffee-dns/${{ matrix.service }}-arm64:${commit_tag} | |
# docker push ghcr.io/coffee-dns/${{ matrix.service }}-amd64:latest | |
# docker push ghcr.io/coffee-dns/${{ matrix.service }}-arm64:latest | |
# docker manifest create "ghcr.io/coffee-dns/${{ matrix.service }}:${commit_tag}" \ | |
# "ghcr.io/coffee-dns/${{ matrix.service }}-amd64:${commit_tag}" \ | |
# "ghcr.io/coffee-dns/${{ matrix.service }}-arm64:${commit_tag}" | |
# docker manifest create "ghcr.io/coffee-dns/${{ matrix.service }}:latest" \ | |
# "ghcr.io/coffee-dns/${{ matrix.service }}-amd64:latest" \ | |
# "ghcr.io/coffee-dns/${{ matrix.service }}-arm64:latest" | |
# docker manifest push "ghcr.io/coffee-dns/${{ matrix.service }}:${commit_tag}" | |
# docker manifest push "ghcr.io/coffee-dns/${{ matrix.service }}:latest" |