Skip to content

Workflow file for this run

name: CI Go
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.22" # Versão do Go 1.22
- name: Build
working-directory: src/sample-go-docker
run: go build -o main .
# lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-go@v3
# with:
# go-version: "1.22.3"
# - name: Install golangci-lint
# working-directory: src/sample-go-docker
# run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
# - name: Run golangci-lint
# working-directory: src/sample-go-docker
# run: golangci-lint run
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.22"
- name: Run tests
working-directory: src/sample-go-docker
run: go test -v ./...
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
working-directory: src/sample-go-docker
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/sample-go-docker:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/sample-go-docker:latest
# - uses: actions/checkout@v3
# - name: Build and push Docker image
# run: |
# docker build -t src/sample-go-docker/Dockerfile .
# docker push src/sample-go-docker
# - name: Deploy to Render.com
# uses: render-actions/deploy@v1
# with:
# service-id: ${{ secrets.RENDER_SERVICE_ID }}
# api-key: ${{ secrets.RENDER_API_KEY }}