From 3a1a02d2d462acd167c8f71c28c97636f43cf430 Mon Sep 17 00:00:00 2001 From: Guillaume Wenzek Date: Sun, 18 Feb 2024 22:34:57 +0100 Subject: [PATCH] use devbox to run linguist validation --- .github/workflows/gh_linguist.yaml | 61 +++++----------- .gitmodules | 6 ++ devbox.json | 35 +++++++++ devbox.lock | 109 +++++++++++++++++++++++++++++ linguist | 1 + pcre | 1 + 6 files changed, 168 insertions(+), 45 deletions(-) create mode 100644 .gitmodules create mode 100644 devbox.json create mode 100644 devbox.lock create mode 160000 linguist create mode 160000 pcre diff --git a/.github/workflows/gh_linguist.yaml b/.github/workflows/gh_linguist.yaml index ae90f23..f165bb3 100644 --- a/.github/workflows/gh_linguist.yaml +++ b/.github/workflows/gh_linguist.yaml @@ -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 @@ -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|git@github.com:|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@v3 + - name: Install devbox + uses: jetpack-io/devbox-install-action@v0.6.0 + - name: Pcre Install + run: devbox run --pure pcre_install + - name: Linguist Build + run: devbox run --pure linguist_build + - name: Linguist Compile + run: devbox run --pure linguist_compile diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d06565d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "linguist"] + path = linguist + url = git@github.com:github-linguist/linguist.git +[submodule "pcre"] + path = pcre + url = https://github.com/vmg/pcre diff --git a/devbox.json b/devbox.json new file mode 100644 index 0000000..b966f38 --- /dev/null +++ b/devbox.json @@ -0,0 +1,35 @@ +{ + "packages": [ + "git@latest", + "cmake@latest", + "icu@latest", + "icu.dev", + "libz@latest", + "go@1.20", + ], + "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", + ], + }, + }, +} diff --git a/devbox.lock b/devbox.lock new file mode 100644 index 0000000..bdf1739 --- /dev/null +++ b/devbox.lock @@ -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" + } + } + }, + "go@1.20": { + "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" + } + } + } + } +} diff --git a/linguist b/linguist new file mode 160000 index 0000000..559a642 --- /dev/null +++ b/linguist @@ -0,0 +1 @@ +Subproject commit 559a6426942abcae16b6d6b328147476432bf6cb diff --git a/pcre b/pcre new file mode 160000 index 0000000..f2b1a56 --- /dev/null +++ b/pcre @@ -0,0 +1 @@ +Subproject commit f2b1a56ddb0a3b9ffe42f45fde2a0d1318eadf90