Skip to content

prevent to return error when the apiclient user attempts to create an… #1160

prevent to return error when the apiclient user attempts to create an…

prevent to return error when the apiclient user attempts to create an… #1160

Workflow file for this run

name: Main
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout 5m --verbose
skip-cache: false
skip-save-cache: false
only-new-issues: true
test:
runs-on: ubuntu-latest
env:
WEB3_URI: ${{ secrets.WEB3_URI }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go environment
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
- name: Tidy go module
run: |
go mod tidy
if [[ $(git status --porcelain) ]]; then
git diff
echo
echo "go mod tidy made these changes, please run 'go mod tidy' and include those changes in a commit"
exit 1
fi
- name: Run Go test
env:
WEB3_URI: ${{ secrets.WEB3_URI }}
run: go test ./...
- name: Run Go test -race
if: github.ref == 'refs/heads/stage' || startsWith(github.ref, 'refs/heads/release')
env:
WEB3_URI: ${{ secrets.WEB3_URI }}
run: go test -vet=off -timeout=15m -race ./... # note that -race can easily make the crypto stuff 10x slower
docker-release:
runs-on: ubuntu-latest
needs: [test, lint]
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stage' || startsWith(github.ref, 'refs/heads/release') || startsWith(github.ref, 'refs/heads/aragon')
steps:
- name: Check out the repo
uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get short commit sha and branch name
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-' )" >> $GITHUB_OUTPUT
- name: Push to Docker Hub and ghcr.io
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: |
vocdoni/${{ github.event.repository.name }}:latest, vocdoni/${{ github.event.repository.name }}:${{ steps.vars.outputs.branch_name }},
ghcr.io/vocdoni/${{ github.event.repository.name }}:latest, ghcr.io/vocdoni/${{ github.event.repository.name }}:${{ steps.vars.outputs.branch_name }}
cache-from: type=gha
cache-to: type=gha,mode=max