Skip to content

[Chore] - Modify instruction #25

[Chore] - Modify instruction

[Chore] - Modify instruction #25

Workflow file for this run

name: build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
strategy:
matrix:
go: [ '1.17.x', '1.18.x','1.19.x', '1.20.x', '1.21.x', '1.22.x' ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/[email protected]
with:
go-version: ${{ matrix.go }}
- name: Run Go Test
id: test
run: go test -race -cover -coverprofile=coverage.txt -covermode=atomic .
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Discord notification
if: ${{ github.run_number == github.run_total_count }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ secrets.DISCORD_USERNAME }}
DISCORD_AVATAR: ${{ secrets.DISCORD_AVATAR }}
DISCORD_EMBEDS: '[ {
"author": { "icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "https://github.com/${{github.actor}}" },
"url": "https://github.com/${{github.repository}}/commit/${{github.sha}}",
"fields": [
{ "name": "Repository", "value": "[${{github.event.repository.name}}](${{github.event.repository.clone_url}})", "inline": true },
{ "name": "Branch", "value": "[${{github.ref_name}}](https://github.com/${{github.repository}}/tree/${{github.ref_name}})", "inline": true },
{ "name": "Event", "value": "${{github.event_name}}", "inline": true },
{ "name": "Job", "value": "${{github.job}}", "inline": true },
{ "name": "Commit Message", "value": "[${{ steps.short-sha.outputs.sha }}](https://github.com/${{github.repository}}/commit/${{github.sha}}) - `${{github.event.head_commit.message}}`" },
{ "name": "Changed Files", "value": "${{ steps.changed-files.outputs.all_changed_files }}" },
{ "name": "Author", "value": "[${{github.actor}}](https://github.com/${{github.actor}})" }
],
"color":1127128,
"timestamp": "${{github.event.head_commit.timestamp}}",
"footer":{"text": "${{github.event.head_commit.timestamp}}"}
} ]'
uses: Ilshidur/action-discord@master
with:
args: 'The commit ${{ github.repository }} has been tested.'