From bba0dc9575c204e778b227ba9f3d0a1423aaa4fa Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 9 Sep 2022 08:14:58 +0800 Subject: [PATCH] build: uses setup-go@v3 to simplify cache config This updates to setup-go@v3 which is the only updated version (v2 last updated in feb), and employs its cache to simplify workflow configuration. Notably, we can't do this for Alpine until #3146 Signed-off-by: Adrian Cole --- .github/workflows/build-macos.yml | 23 ++++++++------------- .github/workflows/linux.yml | 34 ++++++++----------------------- .github/workflows/windows.yml | 14 ++++--------- 3 files changed, 22 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 67430871..57ac3148 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -16,10 +16,6 @@ jobs: name: build-macos runs-on: macos-11 steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.18.1' - name: Install Dependencies shell: bash run: | @@ -35,6 +31,11 @@ jobs: uses: actions/checkout@v2 with: submodules: true + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: '1.18.1' + cache: true - name: Cache LLVM source uses: actions/cache@v3 id: cache-llvm-source @@ -104,23 +105,17 @@ jobs: name: homebrew-install runs-on: macos-latest steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.18' - name: Install LLVM shell: bash run: | HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@14 - name: Checkout uses: actions/checkout@v2 - - name: Cache Go - uses: actions/cache@v3 + - name: Install Go + uses: actions/setup-go@v3 with: - key: go-cache-macos-homebrew-v1-${{ hashFiles('go.mod') }} - path: | - ~/Library/Caches/go-build - ~/go/pkg/mod + go-version: '1.18' + cache: true - name: Build TinyGo run: go install - name: Check binary diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 55b6cc59..00b0c769 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -34,6 +34,7 @@ jobs: with: submodules: true - name: Install Go + # TODO: v2 until https://github.com/tinygo-org/tinygo/issues/3146 uses: actions/setup-go@v2 with: go-version: '1.18.1' @@ -121,9 +122,10 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: '1.18.1' + cache: true - name: Install wasmtime run: | curl https://wasmtime.dev/install.sh -sSf | bash @@ -173,9 +175,10 @@ jobs: simavr \ ninja-build - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: '1.18.1' + cache: true - name: Install Node.js uses: actions/setup-node@v2 with: @@ -184,13 +187,6 @@ jobs: run: | curl https://wasmtime.dev/install.sh -sSf | bash echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH - - name: Cache Go - uses: actions/cache@v3 - with: - key: go-cache-linux-asserts-v1-${{ hashFiles('go.mod') }} - path: | - ~/.cache/go-build - ~/go/pkg/mod - name: Cache LLVM source uses: actions/cache@v3 id: cache-llvm-source @@ -279,16 +275,10 @@ jobs: g++-arm-linux-gnueabihf \ libc6-dev-armhf-cross - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: '1.18.1' - - name: Cache Go - uses: actions/cache@v3 - with: - key: go-cache-linux-arm-v2-${{ hashFiles('go.mod') }} - path: | - ~/.cache/go-build - ~/go/pkg/mod + cache: true - name: Cache LLVM source uses: actions/cache@v3 id: cache-llvm-source @@ -385,16 +375,10 @@ jobs: libc6-dev-arm64-cross \ ninja-build - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: '1.18.1' - - name: Cache Go - uses: actions/cache@v3 - with: - key: go-cache-linux-arm64-v2-${{ hashFiles('go.mod') }} - path: | - ~/.cache/go-build - ~/go/pkg/mod + cache: true - name: Cache LLVM source uses: actions/cache@v3 id: cache-llvm-source diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2c5f15ec..5723e829 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,10 +15,6 @@ jobs: build-windows: runs-on: windows-2022 steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.18.1' - uses: brechtm/setup-scoop@v2 with: scoop_update: 'false' @@ -30,13 +26,11 @@ jobs: uses: actions/checkout@v2 with: submodules: true - - name: Cache Go - uses: actions/cache@v3 + - name: Install Go + uses: actions/setup-go@v3 with: - key: go-cache-windows-v1-${{ hashFiles('go.mod') }} - path: | - ~/AppData/Local/go-build - ~/go/pkg/mod + go-version: '1.18.1' + cache: true - name: Cache LLVM source uses: actions/cache@v3 id: cache-llvm-source