tests(call): add tests for call methods and metrics data #43
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: Build and Release | |
on: | |
push: | |
branches: | |
- master | |
permissions: | |
contents: write # to create release commit (google-github-actions/release-please-action) | |
pull-requests: write # to create release PR (google-github-actions/release-please-action) | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: go | |
- uses: actions/checkout@v3 | |
- name: Set up Go 1.20 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.20 | |
cache: true | |
id: go | |
- name: setup env | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Generate | |
run: | | |
echo "GH_TAG=$(echo $GITHUB_REF | awk -F / '{print $3}')" >> $GITHUB_ENV | |
go install github.com/vektra/mockery/v2@v2.32.0 | |
go generate ./... | |
- name: Test | |
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Build | |
if: ${{ steps.release.outputs.release_created }} | |
env: | |
GOARCH: amd64 | |
CGO_ENABLED: 1 | |
GOOS: linux | |
run: | | |
make release | |
chmod +x up-pp-api | |
- uses: dsaltares/fetch-gh-release-asset@master | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
repo: 'PromptPal/web' | |
file: 'dist.zip' | |
target: 'dist.zip' | |
token: ${{ secrets.GH_PERSONAL_TOKEN }} | |
- uses: montudor/action-zip@v1 | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
args: unzip -qq dist.zip -d public | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
images: annatarhe/prompt-pal | |
tags: ${{ steps.release.outputs.tag_name }} | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
context: . | |
file: ./Dockerfile | |
push: ${{ github.event_name != 'pull_request' && steps.release.outputs.release_created }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |