Skip to content

Commit

Permalink
[ci] Enable caching for proto and integration jobs (#1755)
Browse files Browse the repository at this point in the history
Caching is enabled by default in `actions/setup-go@v4`
(https://githut b.com/actions/setup-go#caching-dependency-files-and-build-outputs)
so update the `go.sum` path when checking out hcsshim to a non-default
path.

Additionally, disable for linting, since that often causes errors.
Without caching, wont need to explicitly delete the module cache.

Relies on: #1752

Signed-off-by: Hamza El-Saawy <[email protected]>
  • Loading branch information
helsaawy authored Jun 2, 2023
1 parent 8d4a20c commit 25b6855
Showing 1 changed file with 48 additions and 27 deletions.
75 changes: 48 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
GOTESTSUM_VERSION: "latest"

jobs:

lint:
runs-on: "windows-2022"
strategy:
Expand All @@ -25,15 +26,18 @@ jobs:
./internal/tools/...
./pkg/...
./ext4/...
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- name: Checkout
uses: actions/checkout@v3

- name: Install go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Clean mod cache
shell: Powershell
run: |
go clean -modcache
# sometimes go cache causes issues with lint
cache: false

- uses: golangci/golangci-lint-action@v3
with:
version: v1.52
Expand All @@ -42,6 +46,7 @@ jobs:
--max-issues-per-linter=0
--max-same-issues=0
--modules-download-mode=readonly
--timeout=10m
${{ matrix.dirs }}
working-directory: ${{ matrix.root }}
env:
Expand All @@ -55,14 +60,16 @@ jobs:
GOPATH: '${{ github.workspace }}\go'

steps:
- uses: actions/setup-go@v4
- name: Checkout hcsshim
uses: actions/checkout@v3
with:
go-version: ${{ env.GO_VERSION }}
path: go/src/github.com/Microsoft/hcsshim

- uses: actions/checkout@v3
- name: Install go
uses: actions/setup-go@v4
with:
path: "go/src/github.com/Microsoft/hcsshim"
name: Checkout hcsshim
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: go/src/github.com/Microsoft/hcsshim/go.sum

- name: Get containerd ref
shell: powershell
Expand All @@ -77,12 +84,12 @@ jobs:
"containerd_ref=$v" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
working-directory: go/src/github.com/Microsoft/hcsshim

- uses: actions/checkout@v3
- name: Checkout containerd
uses: actions/checkout@v3
with:
repository: containerd/containerd
path: "containerd"
ref: "${{ env.containerd_ref }}"
name: Checkout containerd

- name: Install protobuild and protoc-gen-gogoctrd
shell: powershell
Expand Down Expand Up @@ -143,9 +150,11 @@ jobs:
env:
GOPROXY: "https://proxy.golang.org,direct"
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-go@v4
- name: Install go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

Expand Down Expand Up @@ -181,10 +190,14 @@ jobs:
name: Go Generate
runs-on: "windows-2022"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- name: Checkout
uses: actions/checkout@v3

- name: Install go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Validate go generate
shell: powershell
run: |
Expand Down Expand Up @@ -243,8 +256,11 @@ jobs:
matrix:
os: [windows-2019, windows-2022]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- name: Checkout
uses: actions/checkout@v3

- name: Install go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

Expand Down Expand Up @@ -304,10 +320,17 @@ jobs:
os: [windows-2019, windows-2022]

steps:
- uses: actions/setup-go@v4
- name: Checkout hcsshim
uses: actions/checkout@v3
with:
path: src/github.com/Microsoft/hcsshim

- name: Install go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache-dependency-path: src/github.com/Microsoft/hcsshim/go.sum

- name: Set env
shell: bash
Expand All @@ -317,11 +340,6 @@ jobs:
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
echo "${{ github.workspace }}/src/github.com/containerd/containerd/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
with:
path: src/github.com/Microsoft/hcsshim
name: Checkout hcsshim

- name: Get containerd ref
shell: powershell
run: |
Expand Down Expand Up @@ -500,8 +518,11 @@ jobs:
needs: [test-windows, test-linux]
runs-on: "windows-2022"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- name: Checkout
uses: actions/checkout@v3

- name: Install go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

Expand Down

0 comments on commit 25b6855

Please sign in to comment.