0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 10:33:46 +00:00

chore(ci): cleanup CI flows (#595)

* chore: cleanup CI flows

- remove codeql
- pin 3rd-party action versions

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

* run linter only if go files changed

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

* run build/test only if go files changed

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
Pavel Boldyrev 2023-10-01 11:01:22 -04:00 committed by GitHub
parent 5e24a75d09
commit bd09fd3d6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 90 deletions

View File

@ -1,78 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
paths-ignore:
- '**/*.md'
- '**/*.tf'
- 'example/**'
- '.github/**'
- 'docs/**'
- 'Makefile'
schedule:
- cron: '30 9 * * 6'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@ -9,17 +9,30 @@ on:
permissions:
contents: read
pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1
- uses: dorny/paths-filter@v2.2.1
id: filter
with:
filters: |
go:
- '**/*.go'
- uses: actions/setup-go@v4
if: steps.filter.outputs.go == 'true'
with:
go-version-file: 'go.mod'
- name: golangci-lint
if: steps.filter.outputs.go == 'true'
run: |
go run -modfile=tools/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint run -v --timeout 5m

View File

@ -28,14 +28,14 @@ jobs:
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef #v6.0.0
with:
git_user_signingkey: true
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5.0.0
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 #v5.0.0
with:
version: latest
args: release --rm-dist

View File

@ -7,7 +7,7 @@ jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- uses: google-github-actions/release-please-action@4c5670f886fe259db4d11222f7dff41c1382304d #v3.7.12
with:
token: ${{ secrets.BOT_TOKEN }}
release-type: go

View File

@ -1,16 +1,12 @@
name: Tests
on:
pull_request:
paths-ignore:
- 'README.md'
pull_request: {}
push:
branches:
- main
- "release/**"
paths-ignore:
- 'README.md'
jobs:
# ensure the code builds...
build:
name: Build
runs-on: ubuntu-latest
@ -19,16 +15,28 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: dorny/paths-filter@v2.2.1
id: filter
with:
filters: |
go:
- '**/*.go'
- name: Set up Go
if: steps.filter.outputs.go == 'true'
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Get dependencies
if: steps.filter.outputs.go == 'true'
run: go mod download
- name: Build
if: steps.filter.outputs.go == 'true'
run: go vet . && go build -v .
test:
@ -37,18 +45,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: dorny/paths-filter@v2.2.1
id: filter
with:
filters: |
go:
- '**/*.go'
- name: Set up Go
if: steps.filter.outputs.go == 'true'
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Get dependencies
if: steps.filter.outputs.go == 'true'
run: go mod download
- name: Unit tests
if: steps.filter.outputs.go == 'true'
timeout-minutes: 10
run: go test -v -cover ./...