Skip to content

Merge pull request #66 from tinh-tinh/copilot/improve-repo-performance #103

Merge pull request #66 from tinh-tinh/copilot/improve-repo-performance

Merge pull request #66 from tinh-tinh/copilot/improve-repo-performance #103

Workflow file for this run

name: Go
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
# Label of the container job
container-job:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.22.x' ]
# Service containers to run with `container-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Decide if tests should run
id: set_run_tests
run: |
if [[ ("$GITHUB_EVENT_NAME" == "push" && ( "$GITHUB_HEAD_COMMIT_MESSAGE" == fix:* || "$GITHUB_HEAD_COMMIT_MESSAGE" == feat:* || "$GITHUB_HEAD_COMMIT_MESSAGE" == refactor:* || "$GITHUB_HEAD_COMMIT_MESSAGE" == perf:* )) || \
("$GITHUB_EVENT_NAME" == "pull_request" && ( "$GITHUB_PULL_REQUEST_TITLE" == fix:* || "$GITHUB_PULL_REQUEST_TITLE" == feat:* || "$GITHUB_PULL_REQUEST_TITLE" == refactor:* || "$GITHUB_PULL_REQUEST_TITLE" == perf:* )) ]]; then
echo "should_run_tests=true" >> $GITHUB_OUTPUT
else
echo "should_run_tests=false" >> $GITHUB_OUTPUT
fi
env:
GITHUB_HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
GITHUB_PULL_REQUEST_TITLE: ${{ github.event.pull_request.title }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
- name: Test with coverage
if: steps.set_run_tests.outputs.should_run_tests == 'true'
run: |
go test -cover -coverprofile=coverage.txt ./...
- name: Upload coverage reports to Codecov
if: steps.set_run_tests.outputs.should_run_tests == 'true'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: tinh-tinh/queue