Skip to content

Commit

Permalink
[ci] Enable caching for proto and integration jobs (microsoft#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: microsoft#1752

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
(cherry picked from commit 25b6855)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
  • Loading branch information
helsaawy authored and kiashok committed Oct 3, 2023
1 parent a403e74 commit de16dbd
Showing 1 changed file with 49 additions and 27 deletions.
76 changes: 49 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,13 +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 }}
- uses: actions/checkout@v3
path: go/src/github.com/Microsoft/hcsshim

- 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 @@ -75,12 +83,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 @@ -141,9 +149,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 @@ -179,10 +189,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 @@ -241,8 +255,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 @@ -302,10 +319,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 @@ -315,11 +339,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 @@ -501,8 +520,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 de16dbd

Please sign in to comment.