Skip to content

Commit

Permalink
CI: Update setup-go action to v4 (with automatic cache) (#2168)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc authored Jun 27, 2023
1 parent 85839b0 commit 956703c
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 132 deletions.
19 changes: 4 additions & 15 deletions .github/workflows/bats-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,17 @@ jobs:
sudo chmod +w /etc/machine-id
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: "Check out CrowdSec repository"
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Cache Go modules
uses: actions/cache@v3
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.sum"

- name: "Install bats dependencies"
env:
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/bats-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,17 @@ jobs:
sudo chmod +w /etc/machine-id
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: "Check out CrowdSec repository"
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Cache Go modules
uses: actions/cache@v3
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.sum"

- name: "Install bats dependencies"
env:
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/bats-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,17 @@ jobs:
sudo chmod +w /etc/machine-id
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: "Check out CrowdSec repository"
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Cache Go modules
uses: actions/cache@v3
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.sum"

- name: "Install bats dependencies"
env:
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/bats-sqlite-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,17 @@ jobs:
sudo chmod +w /etc/machine-id
echo githubciXXXXXXXXXXXXXXXXXXXXXXXX | sudo tee /etc/machine-id
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: "Check out CrowdSec repository"
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true

- name: Cache Go modules
uses: actions/cache@v3
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.sum"

- name: "Install bats dependencies"
env:
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/ci-windows-build-msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,17 @@ jobs:

steps:

- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: false

- name: Cache Go modules
uses: actions/cache@v3
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.sum"

- name: Build
run: make windows_installer BUILD_RE2_WASM=1
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ jobs:
with:
config: .github/buildkit.toml

# - name: "Build flavor: full"
# uses: docker/build-push-action@v4
# with:
# context: .
# file: ./Dockerfile
# tags: crowdsecurity/crowdsec:test
# target: full
# platforms: linux/amd64
# load: true
# cache-from: type=gha
# cache-to: type=gha,mode=min

- name: "Build flavor: slim"
uses: docker/build-push-action@v4
with:
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/go-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,17 @@ jobs:

steps:

- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Check out CrowdSec repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: false

- name: Cache Go modules
uses: actions/cache@v3
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.sum"

- name: Build
run: |
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,17 @@ jobs:
steps:

- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Check out CrowdSec repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: false

- name: Cache Go modules
uses: actions/cache@v3
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.sum"

- name: Build and run tests, static
run: |
Expand Down
19 changes: 4 additions & 15 deletions .github/workflows/release_publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,17 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: false

- name: Cache Go modules
uses: actions/cache@v3
- name: "Set up Go ${{ matrix.go-version }}"
uses: actions/setup-go@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.sum"

- name: Build the binaries
run: |
Expand Down

0 comments on commit 956703c

Please sign in to comment.