diff --git a/.github/workflows/breaking.yml b/.github/workflows/breaking.yml new file mode 100644 index 0000000..9351341 --- /dev/null +++ b/.github/workflows/breaking.yml @@ -0,0 +1,45 @@ +# This script based on github.com/bool64/dev. + +name: check-api-changes +on: + - pull_request + - push + +jobs: + gorelease: + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: "stable" + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install gorelease + run: go install golang.org/x/exp/cmd/gorelease@latest + + - name: Install egrep + run: which egrep || apt install egrep + + - name: Check API changes + id: gorelease + run: | + OUTPUT=$(gorelease -base=latest || true); + OUTPUT=$(echo "$OUTPUT" | egrep -v "^.*from .*\/internal\/.* to .*\/internal\/.*$"); + OUTPUT="${OUTPUT//'%'/'%25'}" + OUTPUT="${OUTPUT//$'\n'/'%0A'}" + OUTPUT="${OUTPUT//$'\r'/'%0D'}" + echo "::set-output name=report::$OUTPUT"; + + - name: Comment Report + if: always() + uses: marocchino/sticky-pull-request-comment@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: gorelease + message: | + ### API Changes + + ${{ steps.gorelease.outputs.report }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85e7c1d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea/ diff --git a/interface.go b/interface.go index 866cf2c..3ac4e85 100644 --- a/interface.go +++ b/interface.go @@ -40,10 +40,10 @@ const ( // ScopePackage mean fixture function with same parameters called once per package // for use the scope with TearDown function developer must initialize global handler and cleaner at TestMain. - ScopePackage CacheScope = iota + ScopePackage // ScopeTestAndSubtests mean fixture cached for top level test and subtests - ScopeTestAndSubtests CacheScope = iota + ScopeTestAndSubtests ) // FixtureCallbackFunc - function, which result can cached