cicd: 🏗️ fixed pipeline #17
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: Go | |
on: | |
push: | |
branches: [ "gh-actions", "gh-actions-aws" ] | |
pull_request: | |
branches: [ "gh-actions", "gh-actions-aws" ] | |
jobs: | |
testes: | |
runs-on: ${{ matrix.os }} | |
env: | |
HOST: localhost | |
DB_PORT: 5432 | |
USER: root | |
PASSWORD: root | |
DB_NAME: root | |
strategy: | |
matrix: | |
go_versions: ['>=1.18', '1.17', '1.18'] | |
os: ['ubuntu-latest', 'ubuntu-20.04'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configuração inicial do Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go_versions }} | |
- name: Compilando a imagem Docker | |
run: docker-compose build | |
- name: Subindo o banco de dados | |
run: docker-compose up -d | |
- name: Teste do banco de dados | |
run: go test -v main_test.go | |
build: | |
needs: testes | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Compilando a aplicação Go | |
run: go build -v main.go | |
- name: Criando artefatos do repositório | |
uses: actions/[email protected] | |
with: | |
name: Aplicação Go | |
path: main | |
docker: | |
needs: build | |
uses: ./.github/workflows/docker.yml | |
secrets: inherit | |
deploy_EC2: | |
needs: build | |
uses: ./.github/workflows/EC2.yml | |
secrets: inherit |