diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f8a18c0..c448bdb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -34,27 +34,27 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v2 - - name: Run unit tests - uses: cedrickring/golang-action@1.6.0 + - 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 }}:x-oauth-basic@github.com/${{ 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 \ No newline at end of file + prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }} \ No newline at end of file diff --git a/Makefile b/Makefile index 6e58508..1179cc8 100644 --- a/Makefile +++ b/Makefile @@ -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 \ No newline at end of file + go fmt + +readme: + godocdown > README.md + +update: + GOPRIVATE=$(SET_PRIVATE) go get -u ./... + +tidy: + GOPRIVATE=$(SET_PRIVATE) go mod tidy \ No newline at end of file