Skip to content

Refactor cache creation to handle string conversion for object_id and… #36

Refactor cache creation to handle string conversion for object_id and…

Refactor cache creation to handle string conversion for object_id and… #36

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
GIN_MODE: release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Build
run: go build -v ./...
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Test coverage
run: |
go test -v ./... -cover -covermode=count -coverprofile=coverage.out | tee test_output.txt
go tool cover -func=coverage.out | bash scripts/coverage.sh > coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Comment Coverage
uses: actions/github-script@v6
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const coverage = fs.readFileSync('coverage.txt', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: coverage
});
update_deps:
runs-on: ubuntu-latest
needs: test
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Set Up git
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Update dependencies
run: go mod tidy
- name: Commit changes
continue-on-error: true
run: |
git add go.mod go.sum
git commit -m "Update dependencies" || exit
git push