From 7570d5fd1f31ab2f6801be8825f9dc79a1177aca Mon Sep 17 00:00:00 2001 From: Ilya Sevostyanov <1166655+i-sevostyanov@users.noreply.github.com> Date: Tue, 6 Aug 2024 22:02:49 +0400 Subject: [PATCH] ci-cd: update github workflow --- .github/workflows/codeql-analysis.yml | 67 ------------------- .github/workflows/{lint-n-test.yml => go.yml} | 40 ++++++----- .github/workflows/tag.yml | 37 ---------- 3 files changed, 22 insertions(+), 122 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml rename .github/workflows/{lint-n-test.yml => go.yml} (53%) delete mode 100644 .github/workflows/tag.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 0aa4bf6..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,67 +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 ] - schedule: - - cron: '30 8 * * 1' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - 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@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - 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@v1 - - # ℹī¸ 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@v1 diff --git a/.github/workflows/lint-n-test.yml b/.github/workflows/go.yml similarity index 53% rename from .github/workflows/lint-n-test.yml rename to .github/workflows/go.yml index 4fd0878..efd90aa 100644 --- a/.github/workflows/lint-n-test.yml +++ b/.github/workflows/go.yml @@ -1,35 +1,39 @@ --- -name: "Lint and test" +name: Go on: push: - tags: - - v* + paths-ignore: + - '*.md' branches: - - master + - main pull_request: + jobs: - golangci-lint: + vuln-check: + runs-on: ubuntu-latest + steps: + - uses: golang/govulncheck-action@v1 + with: + go-version-file: go.mod + + tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version-file: go.mod - - name: lint - uses: golangci/golangci-lint-action@v6 - with: - version: latest - skip-cache: true - tests: - needs: golangci-lint + - name: Run tests + run: make test + + golangci-lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install Go - uses: actions/setup-go@v5 + - uses: actions/setup-go@v5 with: go-version-file: go.mod - - name: Run test coverage - run: make coverage - - name: Upload coverage to Codecov - run: bash <(curl -s https://codecov.io/bash) + - uses: golangci/golangci-lint-action@v6 + with: + version: latest + skip-cache: true diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml deleted file mode 100644 index 90e8fb4..0000000 --- a/.github/workflows/tag.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: "Release a tag" -on: - push: - tags: - - v* -jobs: - docker-release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - - name: Prepare - id: prepare - run: | - TAG=${GITHUB_REF#refs/tags/} - echo ::set-output name=tag_name::${TAG} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login into GitHub Container Registry - run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - - - name: Build Docker image - run: docker build . --tag ghcr.io/i-sevostyanov/nanodb:${{ steps.prepare.outputs.tag_name }} - - - name: Push image to registry - run: docker push ghcr.io/i-sevostyanov/nanodb:${{ steps.prepare.outputs.tag_name }}