-
Notifications
You must be signed in to change notification settings - Fork 236
59 lines (50 loc) · 1.93 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Linting
on: [push, pull_request]
jobs:
selene:
runs-on: ubuntu-latest
steps:
- name: Restore Cached Selene
id: cache-selene-restore
uses: actions/cache@v3
with:
key: ${{ runner.os }}-selene
path: ~/.cargo/bin/selene
- uses: actions/checkout@v1
- name: Compare the cached Selene version against crates.io
id: check-selene-cache
run: |
CRATES_IO_SELENE_VERSION=$(curl -s -L0 https://crates.io/api/v1/crates/selene | jq -r '.crate.max_stable_version')
CACHED_SELENE_VERSION="$((selene --version || printf "INVALID_VERSION") | awk '{print $2}')"
printf "Crates IO Selene Version: %s\n" "${CRATES_IO_SELENE_VERSION}"
printf "Cached Selene Version: %s\n" "${CACHED_SELENE_VERSION}"
CACHED_SELENE_VALID=false
if [[ "${CRATES_IO_SELENE_VERSION}" == "${CACHED_SELENE_VERSION}" ]]; then
CACHED_SELENE_VALID=true
printf "Cache is valid!\n"
fi
printf "cache-valid=%s\n" "${CACHED_SELENE_VALID}" >> "${GITHUB_OUTPUT}"
- uses: actions-rs/toolchain@v1
if: ${{ steps.check-selene-cache.outputs.cache-valid != 'true'}}
with:
toolchain: stable
- name: Install Selene
if: ${{ steps.check-selene-cache.outputs.cache-valid != 'true'}}
run: cargo install selene --force
- name: Save New Selene Build to Cache
if: ${{ steps.check-selene-cache.outputs.cache-valid != 'true'}}
id: cache-selene-save
uses: actions/cache/save@v3
with:
key: ${{ runner.os }}-selene
path: ~/.cargo/bin/selene
- name: Run Selene
run: make lint
stylua:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: JohnnyMorganz/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --color always --check lua/ tests/