Skip to content

Commit

Permalink
ci: update lint workflow, fix caching
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Jul 11, 2023
1 parent 0dce2bd commit 9d8a98c
Showing 1 changed file with 44 additions and 9 deletions.
53 changes: 44 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,59 @@ on:
workflow_call:

env:
WORK_PATH: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/
GHA_PATH: ${{ github.event.repository.name }}-gha
REPO: ${{ github.event.repository.name }}
MOD_PATH: ~/.vmodules/bartender

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Cache Status
id: cache-status
uses: actions/cache@v3
with:
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:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Restore Cache
uses: actions/cache/restore@v3
with:
path: ${{ env.WORK_PATH }}vlang/
path: vlang
key: ${{ runner.os }}-v-
fail-on-cache-miss: true

- name: Setup V
uses: vlang/setup-v@v1.3

- name: Checkout ${{ github.event.repository.name }}
- name: Checkout ${{ env.REPO }}
uses: actions/checkout@v3
with:
path: ${{ env.GHA_PATH }}

- name: Copy ${{ env.REPO }} to ${{ env.MOD_PATH }}
run: cp -r ${{ env.REPO }} ${{ env.MOD_PATH }}

- name: Check Formatting
run: v fmt -verify ${{ env.GHA_PATH }}
run: v fmt -verify ${{ env.MOD_PATH }}

# Vet includes checking public functions without documentation
# Disable until public functions are documented
Expand All @@ -44,8 +73,14 @@ jobs:
# - 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: Vet Code
# run: v vet -W .
# - name: Copy ${{ env.REPO }} to ${{ env.MOD_PATH }}
# run: cp -r ${{ env.REPO }} ${{ env.MOD_PATH }}
#
# - name: Vet ${{ github.event.repository.name }}
# run: v vet -W ${{ env.MOD_PATH }}/src/

0 comments on commit 9d8a98c

Please sign in to comment.