From 70bdb70c78c61cf33922ec8df30bd4677c9d51bb Mon Sep 17 00:00:00 2001 From: Songmu Date: Mon, 21 Nov 2022 01:10:53 +0900 Subject: [PATCH] introduce tagpr --- .github/actions/release/action.yml | 22 ++++++++++++++++++ .github/workflows/release.yaml | 12 ++-------- .github/workflows/tagpr.yaml | 25 +++++++++++++++++++++ .github/workflows/test.yaml | 36 +++++++++++++----------------- Makefile | 2 +- codecov.yml | 2 ++ go.mod | 2 +- 7 files changed, 68 insertions(+), 33 deletions(-) create mode 100644 .github/actions/release/action.yml create mode 100644 .github/workflows/tagpr.yaml create mode 100644 codecov.yml diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml new file mode 100644 index 0000000..f630dc5 --- /dev/null +++ b/.github/actions/release/action.yml @@ -0,0 +1,22 @@ +name: release +description: release maltmill +inputs: + tag: + description: tag name to be released + default: '' + token: + description: GitHub token + required: true +runs: + using: composite + steps: + - name: setup go + uses: actions/setup-go@v3 + with: + go-version: 1.x + - name: release + run: | + make crossbuild upload + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.token }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 49e73d6..084f9b1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,16 +7,8 @@ jobs: release: runs-on: ubuntu-latest steps: - - name: setup go - uses: actions/setup-go@v3 - with: - go-version: 1.x - name: checkout uses: actions/checkout@v3 + - uses: ./.github/actions/release with: - fetch-depth: 0 - - name: release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - make crossbuild upload + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tagpr.yaml b/.github/workflows/tagpr.yaml new file mode 100644 index 0000000..74af334 --- /dev/null +++ b/.github/workflows/tagpr.yaml @@ -0,0 +1,25 @@ +name: tagpr +on: + push: + branches: + - "main" +jobs: + tagpr: + runs-on: ubuntu-latest + steps: + - name: setup go + uses: actions/setup-go@v3 + with: + go-version: 1.x + - name: checkout + uses: actions/checkout@v3 + - name: tagpr + id: tagpr + uses: Songmu/tagpr@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: ./.github/actions/release + with: + tag: ${{ steps.tagpr.outputs.tag }} + token: ${{ secrets.GITHUB_TOKEN }} + if: "steps.tagpr.outputs.tag != ''" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7d19e48..df160a9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,5 +1,8 @@ name: test -on: [push] +on: + push: + branches: + - "**" jobs: test: runs-on: ${{ matrix.os }} @@ -7,28 +10,19 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest - - macOS-latest - - windows-latest + - ubuntu-latest + - macOS-latest + - windows-latest steps: + - name: checkout + uses: actions/checkout@v3 - name: setup go uses: actions/setup-go@v3 with: - go-version: 1.x - - name: checkout - uses: actions/checkout@v3 + go-version-file: go.mod - name: test - run: | - go test -coverprofile coverage.out ./... - - name: Convert coverage to lcov - uses: jandelgado/gcov2lcov-action@v1.0.0 - with: - infile: coverage.out - outfile: coverage.lcov - if: "matrix.os == 'ubuntu-latest'" - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} - path-to-lcov: coverage.lcov - if: "matrix.os == 'ubuntu-latest'" + run: go test -coverprofile coverage.out -covermode atomic ./... + env: + GITHUB_TOKEN: ${{ secrets.github_token }} + - name: Send coverage + uses: codecov/codecov-action@v1 diff --git a/Makefile b/Makefile index 22f3567..2cbd910 100644 --- a/Makefile +++ b/Makefile @@ -44,4 +44,4 @@ crossbuild: go.sum devel-deps .PHONY: upload upload: - ghr -body="$$(godzil changelog --latest -F markdown)" v$(VERSION) dist/v$(VERSION) + ghr v$(VERSION) $(DIST_DIR) diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..cd96b59 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +comment: false +github_checks: false diff --git a/go.mod b/go.mod index c696abf..3ad6d4e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Songmu/ecschedule -go 1.18 +go 1.19 require ( github.com/aws/aws-sdk-go v1.44.52