From 4b19f7e23d4ffe2bd7883c0563a97b0f0d4383ee Mon Sep 17 00:00:00 2001 From: jspc Date: Sun, 31 Dec 2023 21:22:18 +0000 Subject: [PATCH] Use github actions --- .github/dependabot.yml | 11 ++++++ .github/workflows/ci.yml | 85 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e0871f9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c89b58c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,85 @@ +name: CI + +on: + push: + branches: + - '*' + tags: + - '*' + +permissions: read-all + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-go@v2 + with: + go-version: '>=1.21.0' + + - name: Build + run: | + make + + - name: Test + run: | + go test -covermode=count -coverprofile=coverage.out -v ./... + + - name: Convert coverage to lcov + uses: jandelgado/gcov2lcov-action@v1.0.9 + + - name: Coveralls + uses: coverallsapp/github-action@1.1.3 + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: coverage.lcov + + - name: gosec + run: | + go install github.com/securego/gosec/v2/cmd/gosec@latest + gosec ./... + + - name: golangci-lint + run: | + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 + golangci-lint run --skip-files='.*_test.go' + + - name: Archive stuff + uses: actions/upload-artifact@v3 + with: + name: build-artefacts + path: | + littleauth + + + build-and-push: + needs: test + permissions: + contents: write + + runs-on: ubuntu-latest + if: contains(github.ref, 'refs/tags') + steps: + - uses: actions/checkout@v3 + + - name: Download artefacts + uses: actions/download-artifact@v3 + with: + name: build-artefacts + + - name: Generate SBOM + uses: CycloneDX/gh-gomod-generate-sbom@v1 + with: + version: v1 + args: mod -licenses -json -output bom.json + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + littleauth + bom.json + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}