mirror of
https://github.com/0x5eal/luau-unzip.git
synced 2025-04-10 17:20:53 +01:00
chore(actions): use nix in CI
This commit is contained in:
parent
16b35b4d30
commit
db60b17f1a
1 changed files with 57 additions and 81 deletions
138
.github/workflows/ci.yml
vendored
138
.github/workflows/ci.yml
vendored
|
@ -15,104 +15,67 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install pesde
|
- name: Install nix
|
||||||
uses: lumin-org/setup-pesde@v0.4.0
|
uses: nixbuild/nix-quick-install-action@v29
|
||||||
|
|
||||||
|
- name: Restore and cache Nix store
|
||||||
|
uses: nix-community/cache-nix-action@v5
|
||||||
with:
|
with:
|
||||||
version: v0.6.0-rc.6+registry.0.2.0-rc.2
|
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
|
||||||
token: ${{ secrets.PESDE_TOKEN }}
|
restore-prefixes-first-match: nix-${{ runner.os }}-
|
||||||
cache: true
|
gc-max-store-size-linux: 1073741824
|
||||||
|
purge: true
|
||||||
|
purge-prefixes: cache-${{ runner.os }}-
|
||||||
|
purge-created: 0
|
||||||
|
purge-primary-key: never
|
||||||
|
|
||||||
- name: Extract stylua version in manifest
|
- name: Cache pesde data
|
||||||
uses: SebRollen/toml-action@v1.2.0
|
uses: actions/cache@v4
|
||||||
id: get_semver_range
|
|
||||||
with:
|
with:
|
||||||
file: pesde.toml
|
path: ~/.pesde
|
||||||
field: dev_dependencies.stylua.version
|
key: pesde-${{ runner.os }}-${{ hashFiles('pesde.toml') }}
|
||||||
|
|
||||||
- name: Install semver CLI
|
|
||||||
run: sudo apt-get update && sudo apt-get install node-semver -y
|
|
||||||
|
|
||||||
- name: Parse stylua semver range into version
|
|
||||||
id: stylua
|
|
||||||
run: |
|
|
||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
range="${{ steps.get_semver_range.outputs.value }}"
|
|
||||||
echo "version=$(gh api /repos/JohnnyMorganz/StyLua/tags --jq '.[] | .name' | xargs semver -r "$range" | tail -n 1)" >> $GITHUB_OUTPUT
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Install stylua
|
|
||||||
uses: JohnnyMorganz/stylua-action@v4
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
version: ${{ steps.stylua.outputs.version }}
|
|
||||||
args: --version
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pesde install
|
run: pesde install
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: lune run fmt -- --check
|
run: nix develop -c lune run fmt -- --check
|
||||||
|
|
||||||
typecheck:
|
typecheck:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install pesde
|
|
||||||
uses: lumin-org/setup-pesde@v0.4.0
|
|
||||||
with:
|
|
||||||
version: v0.6.0-rc.6+registry.0.2.0-rc.2
|
|
||||||
token: ${{ secrets.PESDE_TOKEN }}
|
|
||||||
cache: true
|
|
||||||
|
|
||||||
- name: Extract luau-lsp version in manifest
|
- name: Install nix
|
||||||
uses: SebRollen/toml-action@v1.2.0
|
uses: nixbuild/nix-quick-install-action@v29
|
||||||
id: get_semver_range
|
|
||||||
|
- name: Restore and cache Nix store
|
||||||
|
uses: nix-community/cache-nix-action@v5
|
||||||
with:
|
with:
|
||||||
file: pesde.toml
|
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
|
||||||
field: dev_dependencies.luau-lsp.version
|
restore-prefixes-first-match: nix-${{ runner.os }}-
|
||||||
|
gc-max-store-size-linux: 1073741824
|
||||||
- name: Install semver CLI
|
purge: true
|
||||||
run: sudo apt-get update && sudo apt-get install node-semver -y
|
purge-prefixes: cache-${{ runner.os }}-
|
||||||
|
purge-created: 0
|
||||||
- name: Parse luau-lsp semver range into version
|
purge-primary-key: never
|
||||||
id: luau-lsp
|
|
||||||
run: |
|
|
||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
range="${{ steps.get_semver_range.outputs.value }}"
|
- name: Cache pesde data
|
||||||
echo "version=$(gh api /repos/JohnnyMorganz/luau-lsp/tags --jq '.[] | .name' | xargs semver -r "$range" | tail -n 1)" >> $GITHUB_OUTPUT
|
uses: actions/cache@v4
|
||||||
env:
|
with:
|
||||||
GH_TOKEN: ${{ github.token }}
|
path: ~/.pesde
|
||||||
|
key: pesde-${{ runner.os }}-${{ hashFiles('pesde.toml') }}
|
||||||
- name: Install luau-lsp
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
#!/bin/bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
cd /tmp
|
|
||||||
gh release download --repo JohnnyMorganz/luau-lsp "${{ steps.luau-lsp.outputs.version }}" --pattern luau-lsp-linux.zip
|
|
||||||
mkdir -p ~/.local/bin
|
|
||||||
unzip luau-lsp-linux.zip -d ~/.local/bin
|
|
||||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pesde install
|
run: pesde install
|
||||||
|
|
||||||
- name: Setup lune typedefs
|
- name: Setup lune typedefs
|
||||||
run: lune setup
|
run: nix develop -c lune setup
|
||||||
|
|
||||||
- name: Typecheck
|
- name: Typecheck
|
||||||
run: lune run typecheck
|
run: nix develop -c lune run typecheck
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -120,15 +83,28 @@ jobs:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install pesde
|
- name: Install nix
|
||||||
uses: lumin-org/setup-pesde@v0.4.0
|
uses: nixbuild/nix-quick-install-action@v29
|
||||||
|
|
||||||
|
- name: Restore and cache Nix store
|
||||||
|
uses: nix-community/cache-nix-action@v5
|
||||||
with:
|
with:
|
||||||
version: v0.6.0-rc.6+registry.0.2.0-rc.2
|
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
|
||||||
token: ${{ secrets.PESDE_TOKEN }}
|
restore-prefixes-first-match: nix-${{ runner.os }}-
|
||||||
cache: true
|
gc-max-store-size-linux: 1073741824
|
||||||
|
purge: true
|
||||||
|
purge-prefixes: cache-${{ runner.os }}-
|
||||||
|
purge-created: 0
|
||||||
|
purge-primary-key: never
|
||||||
|
|
||||||
|
- name: Cache pesde data
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.pesde
|
||||||
|
key: pesde-${{ runner.os }}-${{ hashFiles('pesde.toml') }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pesde install
|
run: pesde install
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: lune run tests
|
run: nix develop -c lune run tests
|
||||||
|
|
Loading…
Add table
Reference in a new issue