Build multi os/arch docker images and worker deps updated #212
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: Smriti API CI | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- api/** | |
- .github/workflows/** | |
pull_request: | |
branches: | |
- master | |
paths: | |
- api/** | |
- .github/workflows/** | |
release: | |
types: [published] | |
jobs: | |
ci: | |
name: Integration Check | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./api | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.20' | |
- name: Go Version | |
run: go version | |
- name: Run Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54.0 | |
working-directory: api | |
- name: Run Build | |
run: make build | |
- name: Run Test & Cover | |
run: make cover | |
- name: Publish Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: api | |
files: api/coverage.txt | |
publish: | |
if: ${{ (github.event_name == 'release' && github.event.action == 'published') || github.ref == 'refs/heads/master' }} | |
needs: ci | |
name: Publish Docker Image | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./api | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v3 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: api | |
file: ./api/Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7 | |
build-args: | | |
GITSHA=${{ github.sha }} | |
VERSION=${ github.ref_name }} | |
tags: smritihq/api:${{ github.ref_name }} |