mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-14 00:58:32 +00:00
Improve build and release system. (#2)
This commit is contained in:
+14
-15
@@ -34,27 +34,27 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Run unit tests
|
- name: Setup GoLang
|
||||||
uses: cedrickring/[email protected]
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
args: |
|
stable: 'true'
|
||||||
make prepare;
|
- name: Test code
|
||||||
make test CI_RUN=${CI}
|
run: |
|
||||||
- name: Codecov integration
|
git config --global url."https://${{ secrets.GHCR_TOKEN }}:[email protected]/${{ github.repository_owner }}".insteadOf "https://github.com/${{ github.repository_owner }}";
|
||||||
continue-on-error: true
|
make test CI_RUN=${CI}
|
||||||
uses: codecov/codecov-action@v1
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
files: coverage.txt
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create Release
|
name: Create Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ prepare, tests ]
|
needs: [ prepare, tests ]
|
||||||
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
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
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@main
|
uses: actions/create-release@main
|
||||||
@@ -63,7 +63,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tag_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
|
tag_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||||
release_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
|
release_name: v${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||||
body: |
|
body_path: .release_notes
|
||||||
Released automatically after merge to master / main.
|
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
|
||||||
@@ -1,16 +1,26 @@
|
|||||||
CI_RUN?=false
|
CI_RUN?=false
|
||||||
ADDITIONAL_BUILD_FLAGS=""
|
ADDITIONAL_BUILD_FLAGS=""
|
||||||
|
SET_PRIVATE="github.com/telegram-bot-app/*"
|
||||||
|
|
||||||
ifeq ($(CI_RUN), true)
|
ifeq ($(CI_RUN), true)
|
||||||
ADDITIONAL_BUILD_FLAGS="-test.short"
|
ADDITIONAL_BUILD_FLAGS="-test.short"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
prepare:
|
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:
|
test: lint tidy
|
||||||
gocritic check -disable=unslice
|
GOPRIVATE=$(SET_PRIVATE) go test -race $(ADDITIONAL_BUILD_FLAGS)
|
||||||
go test -race $(ADDITIONAL_BUILD_FLAGS) -v -coverprofile coverage.txt -covermode=atomic
|
|
||||||
|
|
||||||
lint:
|
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