From e97fea30ea7a3182e469603c3fae3cda8e957cf8 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 31 May 2023 19:24:17 +0300 Subject: [PATCH] [#122] Update actions for forgejo ci Signed-off-by: Alex Vanin --- .forgejo/workflows/builds.yml | 79 +++++--------------------- .forgejo/workflows/codeql-analysis.yml | 67 ---------------------- .forgejo/workflows/dco.yml | 34 ++++++----- .forgejo/workflows/tests.yml | 78 ++++--------------------- 4 files changed, 40 insertions(+), 218 deletions(-) delete mode 100644 .forgejo/workflows/codeql-analysis.yml diff --git a/.forgejo/workflows/builds.yml b/.forgejo/workflows/builds.yml index a81e6a6..3df5081 100644 --- a/.forgejo/workflows/builds.yml +++ b/.forgejo/workflows/builds.yml @@ -1,73 +1,20 @@ -name: Builds - -on: - pull_request: - branches: - - master - - 'support/*' - types: [ opened, synchronize ] - paths-ignore: - - '**/*.md' +on: [pull_request] jobs: - build_cli: - name: Build CLI - runs-on: ubuntu-20.04 - + builds: + name: Builds + runs-on: ubuntu-latest + strategy: + matrix: + go_versions: [ '1.19', '1.20' ] + fail-fast: false steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Setup Go - uses: actions/setup-go@v2 - with: - go-version: 1.19 - - - name: Restore Go modules from cache - uses: actions/cache@v2 - with: - path: /home/runner/go/pkg/mod - key: deps-${{ hashFiles('go.sum') }} - - - name: Get tree-service client - run: make sync-tree - - - name: Update Go modules - run: make dep - - - name: Build CLI - run: make - - - name: Check version - run: if [[ $(make version) == *"dirty"* ]]; then exit 1; fi - - build_image: - needs: build_cli - name: Build Docker image - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - uses: actions/checkout@v3 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: '${{ matrix.go_versions }}' - - name: Restore Go modules from cache - uses: actions/cache@v2 - with: - path: /home/runner/go/pkg/mod - key: deps-${{ hashFiles('go.sum') }} - - - name: Get tree-service client - run: make sync-tree - - - name: Update Go modules - run: make dep - - - name: Build Docker image - run: make image + - name: Build binary + run: make diff --git a/.forgejo/workflows/codeql-analysis.yml b/.forgejo/workflows/codeql-analysis.yml deleted file mode 100644 index 8598516..0000000 --- a/.forgejo/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: [ master, 'support/*' ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master, 'support/*' ] - schedule: - - cron: '35 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@v2 - - # 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 diff --git a/.forgejo/workflows/dco.yml b/.forgejo/workflows/dco.yml index 397e961..de3c0a4 100644 --- a/.forgejo/workflows/dco.yml +++ b/.forgejo/workflows/dco.yml @@ -1,22 +1,20 @@ -name: DCO check - -on: - pull_request: - branches: - - master - - 'support/*' +on: [pull_request] jobs: - commits_check_job: + dco: + name: DCO runs-on: ubuntu-latest - name: Commits Check steps: - - name: Get PR Commits - id: 'get-pr-commits' - uses: tim-actions/get-pr-commits@master - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: DCO Check - uses: tim-actions/dco@master - with: - commits: ${{ steps.get-pr-commits.outputs.commits }} + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' + + - name: Run commit format checker + uses: https://git.alexvan.in/alexvanin/dco-go@v1 + with: + from: 3fbad97a diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index 06ab9db..f64b816 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -1,96 +1,40 @@ -name: Tests - -on: - pull_request: - branches: - - master - - 'support/*' - types: [opened, synchronize] - paths-ignore: - - '**/*.md' +on: [pull_request] jobs: lint: name: Lint runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Get tree-service client + - name: Sync tree service run: make sync-tree - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: https://github.com/golangci/golangci-lint-action@v2 with: version: latest - cover: - name: Coverage - runs-on: ubuntu-20.04 - - env: - CGO_ENABLED: 1 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19 - - - name: Restore Go modules from cache - uses: actions/cache@v2 - with: - path: /home/runner/go/pkg/mod - key: deps-${{ hashFiles('go.sum') }} - - - name: Get tree-service client - run: make sync-tree - - - name: Update Go modules - run: make dep - - - name: Test and write coverage profile - run: make cover - - - name: Upload coverage results to Codecov - uses: codecov/codecov-action@v1 - with: - fail_ci_if_error: false - path_to_write_report: ./coverage.txt - verbose: true - tests: name: Tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: - go_versions: [ '1.18.x', '1.19.x' ] + go_versions: [ '1.19', '1.20' ] fail-fast: false steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - uses: actions/checkout@v3 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: '${{ matrix.go_versions }}' - - - name: Restore Go modules from cache - uses: actions/cache@v2 - with: - path: /home/runner/go/pkg/mod - key: deps-${{ hashFiles('go.sum') }} - - - name: Get tree-service client + + - name: Sync tree service run: make sync-tree - name: Update Go modules run: make dep - name: Run tests - run: make test + run: make test \ No newline at end of file