Segue o go.yml
name: Go
on: push: branches: [ '' ] pull_request: branches: [ '' ]
jobs: test: runs-on: ${{ matrix.os }} env: HOST: localhost PORT: 5432 USER: root PASSWORD: root DBNAME: root strategy: matrix: go_version: ['1.20', '1.18'] os: ['ubuntu-latest'] steps: - uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go_version }}
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Build-DB
run: docker-compose build
- name: Create-DB
run: docker-compose up -d
- name: Test
run: go test -v ./...
build: needs: test runs-on: ubuntu-latest strategy: matrix: go_version: ['1.20', '1.18'] steps: - uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v3 with: go-version: ${{ matrix.go_version }} - name: Build run: go build -v main.go
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.3.6
with:
name: programa
path: main
docker: needs: build uses: ./.github/workflows/Docker.yml secrets: inherit