Skip to content

Commit

Permalink
Do not run CI for all Go versions and use caching (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdimitrov authored Feb 12, 2024
1 parent f5cf712 commit a32f1c4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
with:
go-version-file: 'go.mod'
cache: false
cache: true
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99
Expand Down
52 changes: 22 additions & 30 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,94 +16,86 @@
# SPDX-License-Identifier: Apache-2.0
on:
workflow_call:
name: Examples # not exactly right to test functionality in such a way but it does act as a set of end to end test cases for the time being, nevertheless should be updated
# Not exactly right to test functionality in such a way, but it does act as a set of end-to-end test cases for the time
# being, nevertheless should be updated
name: Examples
jobs:
get-go-versions:
name: Collect available Go versions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: arnested/go-version-action@b556f8d91b644164318c709d28b9083eaf0c064d
id: versions
client:
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }}
runs-on: ${{ matrix.os }}
needs: get-go-versions
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup - Go ${{ matrix.go-version }}
- name: Setup - Go
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
with:
go-version: ${{ matrix.go-version }}
go-version-file: 'go.mod'
cache: true
- run: make example-client

repository:
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }}
runs-on: ${{ matrix.os }}
needs: get-go-versions
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup - Go ${{ matrix.go-version }}
- name: Setup - Go
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
with:
go-version: ${{ matrix.go-version }}
go-version-file: 'go.mod'
cache: true
- run: make example-repository

multirepo:
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }}
runs-on: ${{ matrix.os }}
needs: get-go-versions
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup - Go ${{ matrix.go-version }}
- name: Setup - Go
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
with:
go-version: ${{ matrix.go-version }}
go-version-file: 'go.mod'
cache: true
- run: make example-multirepo

tuf-client-cli:
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }}
runs-on: ${{ matrix.os }}
needs: get-go-versions
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup - Go ${{ matrix.go-version }}
- name: Setup - Go
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
with:
go-version: ${{ matrix.go-version }}
go-version-file: 'go.mod'
cache: true
- run: make example-tuf-client-cli

root-signing:
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }}
runs-on: ${{ matrix.os }}
needs: get-go-versions
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Setup - Go ${{ matrix.go-version }}
- name: Setup - Go
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
with:
go-version: ${{ matrix.go-version }}
go-version-file: 'go.mod'
cache: true
- run: make example-root-signing
12 changes: 8 additions & 4 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ jobs:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744

- name: Setup - Go
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
with:
go-version-file: 'go.mod'
cache: false
- name: golangci-lint
cache: true

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,28 @@ on:
workflow_call:
name: Tests
jobs:
get-go-versions:
name: Collect available Go versions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: arnested/go-version-action@b556f8d91b644164318c709d28b9083eaf0c064d
id: versions
run:
name: Run
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }}
runs-on: ${{ matrix.os }}
needs: get-go-versions
steps:
- name: Set git to use LF
run: git config --global core.autocrlf false

- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744

- name: Setup - Go ${{ matrix.go-version }}
- name: Setup - Go
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f
with:
go-version: ${{ matrix.go-version }}
go-version-file: 'go.mod'
cache: true

- name: Run tests
run: go test -race -covermode=atomic -coverpkg=./metadata/... -coverprofile=coverage.out ./...

- name: Send coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
flags: Go-${{ matrix.go-version }}

0 comments on commit a32f1c4

Please sign in to comment.