mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-12 00:45:31 +00:00
Improve build and release system. (#2)
This commit is contained in:
+14
-15
@@ -34,27 +34,27 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Run unit tests
|
||||
uses: cedrickring/[email protected]
|
||||
- name: Setup GoLang
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
args: |
|
||||
make prepare;
|
||||
make test CI_RUN=${CI}
|
||||
- name: Codecov integration
|
||||
continue-on-error: true
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: coverage.txt
|
||||
stable: 'true'
|
||||
- name: Test code
|
||||
run: |
|
||||
git config --global url."https://${{ secrets.GHCR_TOKEN }}:[email protected]/${{ github.repository_owner }}".insteadOf "https://github.com/${{ github.repository_owner }}";
|
||||
make test CI_RUN=${CI}
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ prepare, tests ]
|
||||
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get list of the commits since last release
|
||||
run: |
|
||||
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@main
|
||||
@@ -63,7 +63,6 @@ jobs:
|
||||
with:
|
||||
tag_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
release_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
body: |
|
||||
Released automatically after merge to master / main.
|
||||
body_path: .release_notes
|
||||
draft: false
|
||||
prerelease: false
|
||||
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
|
||||
@@ -1,16 +1,26 @@
|
||||
CI_RUN?=false
|
||||
ADDITIONAL_BUILD_FLAGS=""
|
||||
SET_PRIVATE="github.com/telegram-bot-app/*"
|
||||
|
||||
ifeq ($(CI_RUN), true)
|
||||
ADDITIONAL_BUILD_FLAGS="-test.short"
|
||||
endif
|
||||
|
||||
prepare:
|
||||
go get github.com/go-critic/go-critic/cmd/gocritic
|
||||
GOPRIVATE=$(SET_PRIVATE) go get github.com/go-critic/go-critic/cmd/gocritic
|
||||
gocritic check
|
||||
|
||||
test:
|
||||
gocritic check -disable=unslice
|
||||
go test -race $(ADDITIONAL_BUILD_FLAGS) -v -coverprofile coverage.txt -covermode=atomic
|
||||
test: lint tidy
|
||||
GOPRIVATE=$(SET_PRIVATE) go test -race $(ADDITIONAL_BUILD_FLAGS)
|
||||
|
||||
lint:
|
||||
go fmt
|
||||
go fmt
|
||||
|
||||
readme:
|
||||
godocdown > README.md
|
||||
|
||||
update:
|
||||
GOPRIVATE=$(SET_PRIVATE) go get -u ./...
|
||||
|
||||
tidy:
|
||||
GOPRIVATE=$(SET_PRIVATE) go mod tidy
|
||||
Reference in New Issue
Block a user