From 96c4d85995888d0336c26912fc75d1540b8fd5e3 Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Sun, 24 Apr 2022 12:54:07 -0700 Subject: [PATCH] script: yaml formatting (#261) --- .github/workflows/ci.yml | 114 ++++++++++++++---------------- .github/workflows/packages.yml | 1 - .github/workflows/stress.yml | 74 +++++++++---------- .github/workflows/thirdparty.yml | 3 - .golangci.yml | 3 - script/bootstrap | 3 + script/fmt | 3 + tests/thirdparty/make_workflow.go | 1 - 8 files changed, 94 insertions(+), 108 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca1fbbe..3a0102d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,6 @@ name: ci - permissions: contents: read - on: push: branches: @@ -10,7 +8,6 @@ on: pull_request: schedule: - cron: '17 12 * * 6' - jobs: test: strategy: @@ -19,44 +16,41 @@ jobs: platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: - - name: Install Go - uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v3.0.0 - with: - go-version: ${{ matrix.go-version }} - check-latest: true - - name: Configure Go Environment - run: | - echo GOPATH=${{ runner.workspace }} >> $GITHUB_ENV - echo ${{ runner.workspace }}/bin >> $GITHUB_PATH - - name: Go Environment - run: go env - - name: Checkout code - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - persist-credentials: false - - name: Bootstrap - run: ./script/bootstrap - - - name: Build - run: go build ./... - - name: Test - run: go test -bench . ./... - - name: Coverage - run: ./script/coverage - - - name: Upload Unit Test Coverage - uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: unittests.coverprofile - flags: unittests - - name: Upload Integration Test Coverage - uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: integration.coverprofile - flags: integration - + - name: Install Go + uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v3.0.0 + with: + go-version: ${{ matrix.go-version }} + check-latest: true + - name: Configure Go Environment + run: | + echo GOPATH=${{ runner.workspace }} >> $GITHUB_ENV + echo ${{ runner.workspace }}/bin >> $GITHUB_PATH + - name: Go Environment + run: go env + - name: Checkout code + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + with: + persist-credentials: false + - name: Bootstrap + run: ./script/bootstrap + - name: Build + run: go build ./... + - name: Test + run: go test -bench . ./... + - name: Coverage + run: ./script/coverage + - name: Upload Unit Test Coverage + uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: unittests.coverprofile + flags: unittests + - name: Upload Integration Test Coverage + uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: integration.coverprofile + flags: integration lint: strategy: matrix: @@ -64,22 +58,22 @@ jobs: platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: - - name: Install Go - uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v3.0.0 - with: - go-version: ${{ matrix.go-version }} - check-latest: true - - name: Configure Go Environment - run: | - echo GOPATH=${{ runner.workspace }} >> $GITHUB_ENV - echo ${{ runner.workspace }}/bin >> $GITHUB_PATH - - name: Go Environment - run: go env - - name: Checkout code - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - persist-credentials: false - - name: Bootstrap - run: ./script/bootstrap - - name: Lint - run: ./script/lint + - name: Install Go + uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v3.0.0 + with: + go-version: ${{ matrix.go-version }} + check-latest: true + - name: Configure Go Environment + run: | + echo GOPATH=${{ runner.workspace }} >> $GITHUB_ENV + echo ${{ runner.workspace }}/bin >> $GITHUB_PATH + - name: Go Environment + run: go env + - name: Checkout code + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + with: + persist-credentials: false + - name: Bootstrap + run: ./script/bootstrap + - name: Lint + run: ./script/lint diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 7c5ee82..28b73f6 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -8,7 +8,6 @@ on: branches: - master pull_request: - jobs: zeebo-xxh3: runs-on: ubuntu-latest diff --git a/.github/workflows/stress.yml b/.github/workflows/stress.yml index 9106b28..870d8bc 100644 --- a/.github/workflows/stress.yml +++ b/.github/workflows/stress.yml @@ -1,51 +1,45 @@ name: stress - permissions: contents: read - on: schedule: - cron: '33 3 * * 6' - jobs: test: runs-on: ubuntu-latest env: - GOFLAGS: -tags=stress + GOFLAGS: -tags=stress steps: - - name: Install Go - uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v3.0.0 - with: - go-version: 1.18.x - check-latest: true - - name: Configure Go Environment - run: | - echo GOPATH=${{ runner.workspace }} >> $GITHUB_ENV - echo ${{ runner.workspace }}/bin >> $GITHUB_PATH - - name: Go Environment - run: go env - - name: Checkout code - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - persist-credentials: false - - name: Bootstrap - run: ./script/bootstrap - - - name: Generate - run: ./script/generate - - name: Status - run: git status - - - name: Build - run: go build ./... - - name: Test - run: go test -bench . ./... - - name: Coverage - run: ./script/coverage - - - name: Upload Stress Unit Test Coverage - uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: unittests.coverprofile - flags: stress + - name: Install Go + uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab # v3.0.0 + with: + go-version: 1.18.x + check-latest: true + - name: Configure Go Environment + run: | + echo GOPATH=${{ runner.workspace }} >> $GITHUB_ENV + echo ${{ runner.workspace }}/bin >> $GITHUB_PATH + - name: Go Environment + run: go env + - name: Checkout code + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + with: + persist-credentials: false + - name: Bootstrap + run: ./script/bootstrap + - name: Generate + run: ./script/generate + - name: Status + run: git status + - name: Build + run: go build ./... + - name: Test + run: go test -bench . ./... + - name: Coverage + run: ./script/coverage + - name: Upload Stress Unit Test Coverage + uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: unittests.coverprofile + flags: stress diff --git a/.github/workflows/thirdparty.yml b/.github/workflows/thirdparty.yml index 709eecb..83104b1 100644 --- a/.github/workflows/thirdparty.yml +++ b/.github/workflows/thirdparty.yml @@ -1,8 +1,6 @@ name: thirdparty - permissions: contents: read - on: push: branches: @@ -12,7 +10,6 @@ on: pull_request: paths: - "tests/thirdparty/**" - jobs: test: strategy: diff --git a/.golangci.yml b/.golangci.yml index b39c88b..42ec01b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,5 @@ run: timeout: 5m - linters: enable-all: true disable: @@ -32,7 +31,6 @@ linters: - varnamelen - wrapcheck - wsl - linters-settings: depguard: list-type: whitelist @@ -44,7 +42,6 @@ linters-settings: - standard - default - prefix(github.com/mmcloughlin/avo) - issues: exclude-use-default: false exclude: diff --git a/script/bootstrap b/script/bootstrap index e6e420a..c9152cc 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -20,3 +20,6 @@ go install golang.org/x/tools/cmd/goimports@v0.1.10 # gofumpt for stricter formatting. go install mvdan.cc/gofumpt@v0.2.1 + +# yamlfmt for yaml formatting. +go install github.com/gechr/yamlfmt@v0.0.0-20220216093356-e9288cd48d12 diff --git a/script/fmt b/script/fmt index 4a691f2..6a9e668 100755 --- a/script/fmt +++ b/script/fmt @@ -16,3 +16,6 @@ goimports -w -local "${repo}" ${files} # gofumpt for stricter gofmt-compatible format. gofumpt -w ${files} + +# yaml formatting. +find . -name '*.yml' | xargs yamlfmt -w diff --git a/tests/thirdparty/make_workflow.go b/tests/thirdparty/make_workflow.go index 30760b4..d2ac9ab 100644 --- a/tests/thirdparty/make_workflow.go +++ b/tests/thirdparty/make_workflow.go @@ -85,7 +85,6 @@ func GenerateWorkflow(pkgs thirdparty.Packages) ([]byte, error) { g.Linef(" pull_request:") // One job per package. - g.NL() g.Linef("jobs:") g.Indent() for _, pkg := range pkgs {