From bd4dbf5753a78dda82a7ab8b3b218e19a0d4639a Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+tobealive@users.noreply.github.com> Date: Sat, 1 Jul 2023 21:25:42 +0200 Subject: [PATCH] ci: check cache status before v install, add setup step to lint wf --- .github/workflows/ci.yml | 10 +++++++++- .github/workflows/lint.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a9507b..97c67cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,15 @@ jobs: setup: runs-on: ubuntu-latest steps: - - name: Install V + - name: Cache Status + id: cache-status + uses: actions/cache@v3 + with: + path: ${{ env.WORK_PATH }}vlang/ + key: ${{ runner.os }}-v- + + - if: ${{ steps.cache-status.outputs.cache-hit != 'true' }} + name: Install V uses: vlang/setup-v@v1.3 with: check-latest: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e59dac7..3e8ce3b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,6 +8,33 @@ env: MOD_PATH: ~/.vmodules/vibe/ jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: Cache Status + id: cache-status + uses: actions/cache@v3 + with: + path: ${{ env.WORK_PATH }}vlang/ + key: ${{ runner.os }}-v- + + - if: ${{ steps.cache-status.outputs.cache-hit != 'true' }} + name: Install V + uses: vlang/setup-v@v1.3 + with: + check-latest: true + + - if: ${{ steps.cache-status.outputs.cache-hit != 'true' }} + name: Add V Version to Environment + run: echo "V_VER=$(v -v)" >> $GITHUB_ENV + + - if: ${{ steps.cache-status.outputs.cache-hit != 'true' }} + name: Cache V + uses: actions/cache/save@v3 + with: + path: vlang/ + key: ${{ runner.os }}-v-${{ env.V_VER }} + fmt: runs-on: ubuntu-latest steps: