ci: check cache status before v install, add setup step to lint wf #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: | |
workflow_call: | |
env: | |
WORK_PATH: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/ | |
MOD_PATH: ~/.vmodules/vibe/ | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache Status | |
id: cache-status | |
uses: actions/cache | |
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: | |
- name: Restore Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.WORK_PATH }}vlang/ | |
key: ${{ runner.os }}-v- | |
fail-on-cache-miss: true | |
- name: Setup V | |
uses: vlang/setup-v@v1.3 | |
- name: Setup libcurl | |
run: sudo apt install libcurl4-openssl-dev | |
- name: Checkout ${{ github.event.repository.name }} | |
uses: actions/checkout@v3 | |
- name: Copy ${{ github.event.repository.name }} to .vmodules | |
run: cp -r ${{ env.WORK_PATH }} ${{ env.MOD_PATH }} | |
- name: Check Formatting | |
run: v fmt -verify ${{ env.MOD_PATH }} | |
vet: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Restore V Cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.WORK_PATH }}vlang/ | |
key: ${{ runner.os }}-v- | |
fail-on-cache-miss: true | |
- name: Setup V | |
uses: vlang/setup-v@v1.3 | |
- name: Setup libcurl | |
run: sudo apt install libcurl4-openssl-dev | |
- name: Checkout ${{ github.event.repository.name }} | |
uses: actions/checkout@v3 | |
- name: Copy ${{ github.event.repository.name }} to .vmodules | |
run: cp -r ${{ env.WORK_PATH }} ${{ env.MOD_PATH }} | |
- name: Vet ${{ github.event.repository.name }} | |
run: v vet -W ${{ env.MOD_PATH }}/src/ |