From 6d5bbccbaef7086ac7652d1786ee14484e5d0e3b Mon Sep 17 00:00:00 2001 From: Rez Moss Date: Tue, 8 Oct 2024 13:12:08 -0400 Subject: [PATCH 1/3] fixed #12 --- .github/workflows/test-fmt.yaml | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/test-fmt.yaml diff --git a/.github/workflows/test-fmt.yaml b/.github/workflows/test-fmt.yaml new file mode 100644 index 0000000..4c428bf --- /dev/null +++ b/.github/workflows/test-fmt.yaml @@ -0,0 +1,53 @@ +name: Go Package CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' + + - name: Install dependencies + run: make deps + + - name: Run all checks and tests + run: make check + + format: + needs: test + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' + + - name: Format code + run: make fmt + + - name: Check for changes + id: git-check + run: | + git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT + + - name: Create Pull Request + if: steps.git-check.outputs.changes == 'true' + uses: peter-evans/create-pull-request@v5 + with: + commit-message: Apply formatting changes + title: 'Auto-format Go code' + body: 'This PR applies automatic formatting to Go code.' + branch: auto-format-${{ github.head_ref }} \ No newline at end of file From 1a03ae3de7f8b9ffa041a02be3203c113c906a45 Mon Sep 17 00:00:00 2001 From: Rez Moss Date: Tue, 8 Oct 2024 13:14:57 -0400 Subject: [PATCH 2/3] upd go ver --- .github/workflows/test-fmt.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-fmt.yaml b/.github/workflows/test-fmt.yaml index 4c428bf..45aade8 100644 --- a/.github/workflows/test-fmt.yaml +++ b/.github/workflows/test-fmt.yaml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.20' + go-version: '1.22' - name: Install dependencies run: make deps @@ -33,7 +33,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.20' + go-version: '1.22' - name: Format code run: make fmt From 2654a26f9d1bc64eac7efd927eb1b1fcc48bde80 Mon Sep 17 00:00:00 2001 From: Rez Moss Date: Tue, 8 Oct 2024 13:17:48 -0400 Subject: [PATCH 3/3] fixed tests --- .github/workflows/test-fmt.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-fmt.yaml b/.github/workflows/test-fmt.yaml index 45aade8..1d2b1aa 100644 --- a/.github/workflows/test-fmt.yaml +++ b/.github/workflows/test-fmt.yaml @@ -21,7 +21,9 @@ jobs: run: make deps - name: Run all checks and tests - run: make check + run: | + make test-all + make check-examples format: needs: test