From e94bd8d7a178835c08c80ddb2ff545b0cc0090ae Mon Sep 17 00:00:00 2001 From: ihatemodels Date: Sun, 26 Nov 2023 15:39:33 +0200 Subject: [PATCH] add GH action workflows --- .github/workflows/codeql.yaml | 58 +++++++++++++++++++++++++++++++++++ .github/workflows/test-mr.yml | 28 +++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .github/workflows/codeql.yaml create mode 100644 .github/workflows/test-mr.yml diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml new file mode 100644 index 0000000..a43c35d --- /dev/null +++ b/.github/workflows/codeql.yaml @@ -0,0 +1,58 @@ +name: codeql + +on: + push: + branches: + - 'main' + paths-ignore: + - '**/*.md' + - '**/*.txt' + - '**/*.yaml' + - '**/*_test.go' + pull_request: + branches: + - 'main' + paths-ignore: + - '**/*.md' + - '**/*.txt' + - '**/*.yaml' + - '**/*_test.go' + +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 + uses: actions/checkout@v4 + - + name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + check-latest: true + - + 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 + with: + category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/test-mr.yml b/.github/workflows/test-mr.yml new file mode 100644 index 0000000..12adf5c --- /dev/null +++ b/.github/workflows/test-mr.yml @@ -0,0 +1,28 @@ +name: Go Test on Pull Request + +on: + pull_request: + branches: [ main ] + +jobs: + tests: + name: Run Go Tests + runs-on: ubuntu-latest + + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.21' # Use the version of Go your project requires + + - name: Check out code + uses: actions/checkout@v2 + + - name: "Run Linters" + uses: golangci/golangci-lint-action@latest + with: + version: latest + args: --verbose + + - name: Run tests + run: go test -v ./...