From 00c208a25042775eb709f879f27344cd7d4a4b38 Mon Sep 17 00:00:00 2001 From: HugeFrog24 <62775760+HugeFrog24@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:27:17 +0200 Subject: [PATCH] Again, CI --- .github/workflows/go-ci.yaml | 54 ++++++++++++++++++++++++++++++++++++ go.mod | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/go-ci.yaml diff --git a/.github/workflows/go-ci.yaml b/.github/workflows/go-ci.yaml new file mode 100644 index 0000000..e3a711e --- /dev/null +++ b/.github/workflows/go-ci.yaml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # Checkout the repository + - name: Checkout code + uses: actions/checkout@v3 + + # Set up Go environment + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23' # Specify the Go version you are using + + # Cache Go modules + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + # Install Dependencies + - name: Install Dependencies + run: go mod tidy + + # Run Linters using golangci-lint + - name: Lint Code + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 # Specify the version of golangci-lint + args: --timeout 5m + + # Run Tests + - name: Run Tests + run: go test ./... -v + + # Security Analysis using gosec + - name: Security Scan + uses: securego/gosec@master + with: + args: ./... diff --git a/go.mod b/go.mod index a3c2ad7..5ff897e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/HugeFrog24/go-telegram-bot -go 1.23.2 +go 1.23 require ( github.com/go-telegram/bot v1.9.0