Skip to content

Debug

Debug #50

Workflow file for this run

name: Lint & test & build
on:
push:
pull_request:
permissions:
contents: read
pull-requests: read
checks: write
env:
DO_PUSH: ${{ github.ref == 'refs/heads/main' }}
BRANCH: ${{ github.ref }}
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.5
cache: false
- name: Generate
run: |-
go get github.com/mailru/easyjson
go install github.com/mailru/easyjson/...@latest
make gen
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
only-new-issues: true
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true
working-directory: .
version: v1.56.2
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.5
- name: Generate
run: |-
go get github.com/mailru/easyjson
go install github.com/mailru/easyjson/...@latest
make gen
- name: Test
run: ROOT_DIR=${PWD} go test -failfast ./...
env:
CFG_PATH: ./conf/config.example.json
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
if: env.DO_PUSH == true
uses: docker/#-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64/v8
- name: debug
run: echo ${{ env.DO_PUSH }} && echo ${{ env.BRANCH }}
- name: Build
if: env.DO_PUSH != true
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: false
platforms: linux/amd64
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/logfowd:0.0.13
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/logfowd:latest
- name: Build and push
if: env.DO_PUSH == true
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: true
platforms: linux/amd64,linux/arm64/v8
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/logfowd:0.0.13
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/logfowd:latest
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/logfowd:latest,mode=max