From 78765c87bd5c7a939cbd8eced3dfd3e756b8d3e9 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Tue, 19 Mar 2024 10:21:59 +0200 Subject: [PATCH] Update GitHub Actions workflows --- .github/workflows/analyze.yml | 31 +++++++++++++++++++++ .github/workflows/ci.yml | 39 --------------------------- .github/workflows/codeql-analysis.yml | 38 -------------------------- .github/workflows/lint.yml | 34 +++++++++++++++++++++++ .github/workflows/test.yml | 34 +++++++++++++++++++++++ go.mod | 2 +- 6 files changed, 100 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/analyze.yml delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml new file mode 100644 index 0000000..644aff6 --- /dev/null +++ b/.github/workflows/analyze.yml @@ -0,0 +1,31 @@ +name: Analyze + +on: + push: + branches: [master] + pull_request: + branches: [master] + schedule: + - cron: "0 6 * * 1" + +permissions: + actions: read + contents: read + security-events: write + +jobs: + analyze: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: go + queries: security-and-quality + + - name: Run CodeQL analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index c0a6d2a..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: CI - -on: - push: - branches: [master] - pull_request: - branches: [master] -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - go: ['1.17', '1.16'] - steps: - - name: Setup - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} - - - name: Checkout - uses: actions/checkout@v4 - - - name: Dependencies - run: | - go version - go get -v -t -d ./... - go get -u golang.org/x/lint/golint - - - name: Lint - run: golint -set_exit_status=1 ./... - - - name: Vet - run: go vet ./... - - - name: Test - run: go test -v -coverprofile=coverage.txt -covermode=atomic ./... - - - name: Coverage - uses: codecov/codecov-action@v3 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index fd97148..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - schedule: - - cron: '0 6 * * 1' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'go' ] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..97881b3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,34 @@ +name: Lint + +on: + push: + branches: [master] + pull_request: + +permissions: + contents: read + +jobs: + lint: + strategy: + matrix: + go: ['1.21'] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Setup + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - name: Prepare checkout + run: git config --global core.autocrlf false + + - name: Checkout + uses: actions/checkout@v4 + + - name: Lint + uses: golangci/golangci-lint-action@v4.0.0 + with: + version: "v1.54" + args: --timeout=5m diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..60d56a3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test + +on: + push: + branches: [master] + pull_request: + +permissions: + contents: read + +jobs: + test: + strategy: + matrix: + go: ['1.21'] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Setup + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - name: Prepare checkout + run: git config --global core.autocrlf false + + - name: Checkout + uses: actions/checkout@v4 + + - name: Test + run: go test -v -coverprofile coverage.txt -covermode atomic ./... + + - name: Coverage + uses: codecov/codecov-action@v4 diff --git a/go.mod b/go.mod index 1f7e07a..ed7b1c0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/adrg/frontmatter -go 1.14 +go 1.19 require ( github.com/BurntSushi/toml v1.3.2