Skip to content

Commit

Permalink
use devbox to run linguist validation
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenzek committed Feb 18, 2024
1 parent 4f626d8 commit b2ca4c8
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 48 deletions.
61 changes: 16 additions & 45 deletions .github/workflows/gh_linguist.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Run Tests
name: GH linguist

on:
push:
branches:
- master
paths:
- '**/*.YAML-tmLanguages'
- '.github/workflows/*.yaml'
- 'devbox.json'
- '.gitmodules'
pull_request:
branches:
- master
Expand All @@ -13,49 +18,15 @@ permissions:

jobs:
run:
name: Ruby ${{ matrix.ruby }}
name: GH linguist validation
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [ '3.2' ]
steps:
- uses: actions/checkout@v1
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Fetch grammar submodules
run: |
git fetch origin master:master v2.0.0:v2.0.0 test/attributes:test/attributes test/master:test/master
sed -i 's|[email protected]:|https://github.com/|' .gitmodules
git submodule init
git submodule sync --quiet
script/fast-submodule-update
- name: Run tests
run: bundle exec rake
dockerfile:
name: Test Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build container
run: docker build -t linguist .
- name: Analyse current directory
run: docker run --rm -v $(pwd):$(pwd) -w $(pwd) --user $(id -u) -t linguist | tee output
- name: Confirm analysis
run: grep Ruby output
classifier:
name: Classifier cross-validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Build
run: bundle exec rake samples
- name: Run cross-validation
run: bundle exec script/cross-validation --test 2>&1
- uses: actions/checkout@v4
- name: Install devbox
uses: jetpack-io/[email protected]
- name: Pcre Install
run: devbox run pcre_install
- name: Linguist Build
run: devbox run linguist_build
- name: Linguist Compile
run: devbox run linguist_compile
4 changes: 2 additions & 2 deletions .github/workflows/st4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:

# https://github.com/actions/checkout
- name: Checkout Packages
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: st_syntax_tests/Data/Packages
path: st_syntax_tests/Data/Packages/Zig Language

- name: Get binary for ${{ matrix.sublime-channel }} build ${{ matrix.sublime-build }}
run: |
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "linguist"]
path = linguist
url = https://github.com/github-linguist/linguist
[submodule "pcre"]
path = pcre
url = https://github.com/vmg/pcre
2 changes: 1 addition & 1 deletion Syntaxes/syntax_test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// keywords and constructs to use in testing.

const std = @import("std");
//^^^ storage.modifier.zig
//^^^ storage.modifier.foo
// ^ keyword.operator.assignment.zig
// ^^^^^^^ keyword.control.import.zig
// ^ punctuation.section.parens.begin.zig
Expand Down
35 changes: 35 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"packages": [
"git@latest",
"cmake@latest",
"icu@latest",
"icu.dev",
"libz@latest",
"[email protected]",
],
"shell": {
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null",
],
"scripts": {
"pcre_install": [
"git submodule update --init pcre",
"mkdir -p pcre/build",
"cd pcre/build",
"cmake .. -DPCRE_SUPPORT_JIT=ON -DPCRE_SUPPORT_UTF=ON -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_BUILD_TESTS=OFF -G 'Unix Makefiles'",
"make",
],
"linguist_build": [
"export PCRE=`realpath pcre/build`",
"git submodule update --init linguist",
"cd linguist/tools/grammars",
"CGO_CFLAGS=-I$PCRE CGO_LDFLAGS=-L$PCRE go build ./cmd/grammar-compiler",
],
"linguist_compile": [
"echo '../Syntaxes:\n- source.zig\n' > linguist/Grammars.yaml",
"cd linguist",
"./tools/grammars/grammar-compiler compile",
],
},
},
}
109 changes: 109 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"lockfile_version": "1",
"packages": {
"cmake@latest": {
"last_modified": "2024-01-27T14:55:31Z",
"resolved": "github:NixOS/nixpkgs/160b762eda6d139ac10ae081f8f78d640dd523eb#cmake",
"source": "devbox-search",
"version": "3.27.8",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/6y1ckjmmmnmz1k2qrahy5hvmlq8bn3lp-cmake-3.27.8"
},
"aarch64-linux": {
"store_path": "/nix/store/m16f4yj9i3fgq5dkx7amcf2v9wp80kc7-cmake-3.27.8"
},
"x86_64-darwin": {
"store_path": "/nix/store/rzgfrfrksq3szf29kdly4qzj1gjsgb30-cmake-3.27.8"
},
"x86_64-linux": {
"store_path": "/nix/store/jacf2kn4dfj99c3ywbvfyg6w53xvxsfl-cmake-3.27.8"
}
}
},
"git@latest": {
"last_modified": "2024-01-27T14:55:31Z",
"resolved": "github:NixOS/nixpkgs/160b762eda6d139ac10ae081f8f78d640dd523eb#git",
"source": "devbox-search",
"version": "2.43.0",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/ylm8lw53fkk4hmxaccirg67fcrwp4q6w-git-2.43.0"
},
"aarch64-linux": {
"store_path": "/nix/store/ylpc6py8hgvmq98z94jwswilmj2gb8hj-git-2.43.0"
},
"x86_64-darwin": {
"store_path": "/nix/store/h8ch2sy5gv6ry9hwmmsxsn6hbm6pdc9r-git-2.43.0"
},
"x86_64-linux": {
"store_path": "/nix/store/za04kin80ybavb7qp577dghpax4mf82z-git-2.43.0"
}
}
},
"[email protected]": {
"last_modified": "2024-02-08T11:55:47Z",
"resolved": "github:NixOS/nixpkgs/c0b7a892fb042ede583bdaecbbdc804acb85eabe#go_1_20",
"source": "devbox-search",
"version": "1.20.14",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/grssyc88y7jnddbyp03an4l71zkh3x4f-go-1.20.14"
},
"aarch64-linux": {
"store_path": "/nix/store/kan8sk8clv4s4mwvg4r2f7lixm160l0y-go-1.20.14"
},
"x86_64-darwin": {
"store_path": "/nix/store/0c52l52r5v3lyic4wdy7qa08173xlpl3-go-1.20.14"
},
"x86_64-linux": {
"store_path": "/nix/store/0cy1cmx9hrmhb0d79rm0rqg9n9498w87-go-1.20.14"
}
}
},
"icu.dev": {
"resolved": "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c#icu.dev",
"source": "nixpkg"
},
"icu@latest": {
"last_modified": "2024-01-27T14:55:31Z",
"resolved": "github:NixOS/nixpkgs/160b762eda6d139ac10ae081f8f78d640dd523eb#icu",
"source": "devbox-search",
"version": "73.2",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/piyi6fbji61v4k6f3117pv03rn8f13k7-icu4c-73.2"
},
"aarch64-linux": {
"store_path": "/nix/store/n0a6sahss26zk42fcg4p144fx9xsrcgs-icu4c-73.2"
},
"x86_64-darwin": {
"store_path": "/nix/store/w2vxc3rmrsx9c46505shaw8z7lzpzjgg-icu4c-73.2"
},
"x86_64-linux": {
"store_path": "/nix/store/v3bkb7jmz1d4q2wf3zzd3r8d4y5bndp7-icu4c-73.2"
}
}
},
"libz@latest": {
"last_modified": "2024-01-27T14:55:31Z",
"resolved": "github:NixOS/nixpkgs/160b762eda6d139ac10ae081f8f78d640dd523eb#libz",
"source": "devbox-search",
"version": "2018-03-31",
"systems": {
"aarch64-darwin": {
"store_path": "/nix/store/1x3lc7jpchi544b57www0wwkgc6fxfnc-libz-unstable-2018-03-31"
},
"aarch64-linux": {
"store_path": "/nix/store/whsfl0xs9rzv1h27mg2w68rlzpv77ld7-libz-unstable-2018-03-31"
},
"x86_64-darwin": {
"store_path": "/nix/store/d757nqig21s06l4gdb4i9p15m5gh838x-libz-unstable-2018-03-31"
},
"x86_64-linux": {
"store_path": "/nix/store/7ifn28sg1p3k7jkksr529p092ysa8ki0-libz-unstable-2018-03-31"
}
}
}
}
}
1 change: 1 addition & 0 deletions linguist
Submodule linguist added at 559a64
1 change: 1 addition & 0 deletions pcre
Submodule pcre added at f2b1a5

0 comments on commit b2ca4c8

Please sign in to comment.