Update ci.yml #19
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
ci: | |
name: Integration | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
go_version: | |
- '1.20' | |
- '1.21' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go_version }} | |
- name: Set up tools | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2 | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: make build | |
- name: Test | |
run: make test-race | |
- name: Coverage | |
run: | | |
make coverage | |
mv coverage-dev.txt coverage.txt | |
bash <(curl -s https://codecov.io/bash) | |
- name: Lint | |
run: make lint | |
- name: Code Analysis | |
run: make ca | |
- name: Notify Telegram | |
uses: yanzay/notify-telegram@v0.1.0 | |
continue-on-error: true | |
if : always() | |
with: | |
chat: ${{ secrets.chat }} | |
token: ${{ secrets.token }} | |
status: ${{ job.status }} | |
build-image: | |
name: Build Image for Deployment | |
needs: ci | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_IMAGE: ghcr.io/euler-b/golang-venezuela/adan-bot | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: "Login into Github Container Registry (a.k.a. ghcr.io)" | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.CI_TOKEN_BOT}} | |
- name: "Build and push Docker image to Github Container Registry ('latest')" | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
docker build --tag $DOCKER_IMAGE:latest . | |
docker push $DOCKER_IMAGE:latest |