diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2acbb0baa..ba005c56c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,16 +30,26 @@ jobs: runs-on: ubuntu-20.04 steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + # to add commit DCO checks later + fetch-depth: 21 + - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - - name: Check out code into the Go module directory - uses: actions/checkout@v4 + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 with: - # to add commit DCO checks later - fetch-depth: 21 + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Check code uses: golangci/golangci-lint-action@v4.0.0 diff --git a/.github/workflows/build_setup.yml b/.github/workflows/build_setup.yml index 1601073d2..4cca46d9e 100644 --- a/.github/workflows/build_setup.yml +++ b/.github/workflows/build_setup.yml @@ -22,13 +22,25 @@ jobs: name: Build setup scripts runs-on: ubuntu-20.04 steps: - - name: Set up Go 1.21 + + - name: Check out the code + uses: actions/checkout@v4 + + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum - - name: Check out the code - uses: actions/checkout@v4 + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Build scripts run: pushd scripts && go build -o setup_tool && popd diff --git a/.github/workflows/cri_minio_test.yml b/.github/workflows/cri_minio_test.yml index e8ab7f199..e8d9cf678 100644 --- a/.github/workflows/cri_minio_test.yml +++ b/.github/workflows/cri_minio_test.yml @@ -33,14 +33,25 @@ jobs: steps: - name: Setup TMPDIR run: mkdir -p $TMPDIR + + - name: Check out code into the Go module directory + uses: actions/checkout@v4 - - name: Set up Go 1.21 + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum - - name: Check out code into the Go module directory - uses: actions/checkout@v4 + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Build run: go build diff --git a/.github/workflows/cri_stock_containerd_test.yml b/.github/workflows/cri_stock_containerd_test.yml index 2dc5c3d9c..86067edbd 100644 --- a/.github/workflows/cri_stock_containerd_test.yml +++ b/.github/workflows/cri_stock_containerd_test.yml @@ -23,10 +23,21 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v4 - - name: Set up golang + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum + + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Build setup scripts run: pushd scripts && go build -o setup_tool && popd diff --git a/.github/workflows/cri_tests.yml b/.github/workflows/cri_tests.yml index aadf88bd6..75fc7e21e 100644 --- a/.github/workflows/cri_tests.yml +++ b/.github/workflows/cri_tests.yml @@ -27,10 +27,21 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up golang + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum + + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Add rsync run: | diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 2bfcd88e4..42f937f94 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -30,32 +30,37 @@ jobs: matrix: test-name: [test, test-man-bench] steps: + + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + lfs: true - - name: Set up Go 1.21 + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum + + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Set up Python 3.x uses: actions/setup-python@v5 with: python-version: '3.x' - - - name: Upgrade git - run: | - sudo add-apt-repository ppa:git-core/ppa -y - sudo apt update - sudo apt install git -y - name: Add rsync run: | sudo apt update sudo apt install rsync -y - - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - with: - lfs: true - name: Build setup scripts run: pushd scripts && go build -o setup_tool && popd diff --git a/.github/workflows/nightly_tests.yml b/.github/workflows/nightly_tests.yml index 7707a2b72..70a4c2098 100644 --- a/.github/workflows/nightly_tests.yml +++ b/.github/workflows/nightly_tests.yml @@ -19,22 +19,27 @@ jobs: steps: - name: Setup TMPDIR run: mkdir -p $TMPDIR + + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + lfs: true - - name: Set up Go 1.21 + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum - - name: Upgrade git - run: | - sudo add-apt-repository ppa:git-core/ppa -y - sudo apt update - sudo apt install git -y - - - name: Check out code into the Go module directory - uses: actions/checkout@v4 + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 with: - lfs: true + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Build setup scripts run: pushd scripts && go build -o setup_tool && popd @@ -77,13 +82,24 @@ jobs: - name: Setup TMPDIR run: mkdir -p $TMPDIR - - name: Set up Go 1.21 + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum - - name: Check out code into the Go module directory - uses: actions/checkout@v4 + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Build setup scripts run: pushd scripts && go build -o setup_tool && popd diff --git a/.github/workflows/openyurt-unit-test.yml b/.github/workflows/openyurt-unit-test.yml index f3187e7fa..f705abed7 100644 --- a/.github/workflows/openyurt-unit-test.yml +++ b/.github/workflows/openyurt-unit-test.yml @@ -22,13 +22,24 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.21 + - name: Check out the code + uses: actions/checkout@v4 + + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum - - name: Check out the code - uses: actions/checkout@v4 + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Build scripts run: diff --git a/.github/workflows/stargz_tests.yml b/.github/workflows/stargz_tests.yml index 2ad8519e2..a3ecd4062 100644 --- a/.github/workflows/stargz_tests.yml +++ b/.github/workflows/stargz_tests.yml @@ -42,10 +42,21 @@ jobs: - name: Checkout LFS objects run: git lfs checkout - - name: Set up Go 1.21 + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum + + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Build setup scripts run: pushd scripts && go build -o setup_tool && popd diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 8cd9def45..ccd5672cb 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -28,20 +28,30 @@ jobs: matrix: module: [misc, networking, snapshotting] steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 - - name: Set up Go 1.21 + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' - + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum + + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Set up Python 3.x uses: actions/setup-python@v5 with: python-version: '3.x' - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - name: Build setup scripts run: pushd scripts && go build -o setup_tool && popd @@ -73,20 +83,30 @@ jobs: matrix: module: [profile] steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 - - name: Set up Go 1.21 + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' - + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum + + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 + with: + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Set up Python 3.x uses: actions/setup-python@v5 with: python-version: '3.x' - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - name: Build setup scripts run: pushd scripts && go build -o setup_tool && popd @@ -121,22 +141,26 @@ jobs: matrix: module: [ ctriface, ctriface/image, devmapper ] steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + lfs: true - - name: Set up Go 1.21 + - name: Set up Go version in go.mod file uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version-file: ${{ github.workspace }}/go.mod + cache-dependency-path: ${{ github.workspace }}/go.sum - - name: Upgrade git - run: | - sudo add-apt-repository ppa:git-core/ppa -y - sudo apt update - sudo apt install git -y - - - name: Check out code into the Go module directory - uses: actions/checkout@v4 + - name: Cache Go Modules and Build Cache + uses: actions/cache@v3 with: - lfs: true + path: | + /home/runner/go/pkg/mod + /home/runner/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Add rsync run: |