├── .github └── workflows │ └── test.yml ├── LICENSE ├── README.md ├── action.yml ├── syntax-tests.sh └── test ├── defpkg ├── Test.sublime-syntax └── syntax_test_test ├── dummy-syntax ├── Test.sublime-syntax └── syntax_test_test ├── no_defpkg ├── Test.sublime-syntax └── syntax_test_test ├── st3 └── syntax_test_js.js └── third-party ├── Test.sublime-syntax └── syntax_test_test /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | push: 5 | pull_request: 6 | schedule: 7 | - cron: "* 0 * * SAT" 8 | workflow_dispatch: 9 | 10 | jobs: 11 | no_defpkg_stable: 12 | name: Without default packages, latest stable 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: ./ 17 | with: 18 | build: stable 19 | package_root: test/no_defpkg 20 | 21 | # TODO indentation tests 22 | # TODO reference & definition tests 23 | 24 | defpkg_stable: 25 | name: With default packages, latest stable 26 | runs-on: ubuntu-latest 27 | steps: 28 | - uses: actions/checkout@v4 29 | - uses: ./ 30 | with: 31 | build: stable 32 | default_packages: binary 33 | package_root: test/defpkg 34 | 35 | no_defpkg_old_build: 36 | name: Without default packages, build 4073 37 | runs-on: ubuntu-latest 38 | steps: 39 | - uses: actions/checkout@v4 40 | - uses: ./ 41 | with: 42 | build: 4073 43 | package_root: test/no_defpkg 44 | 45 | third-party_stable: 46 | name: Third-party, latest stable 47 | runs-on: ubuntu-latest 48 | steps: 49 | - name: Checkout repo (primary package) 50 | uses: actions/checkout@v4 51 | - name: Checkout INI package (dependency) 52 | uses: actions/checkout@v4 53 | with: 54 | repository: jwortmann/ini-syntax 55 | ref: v1.5.0 56 | path: third-party/INI 57 | - uses: ./ 58 | with: 59 | build: stable 60 | package_root: test/third-party 61 | additional_packages: third-party/INI 62 | 63 | dummy_syntax_stable: 64 | name: Dummy Syntax, latest stable 65 | runs-on: ubuntu-latest 66 | steps: 67 | - name: Checkout repo (primary package) 68 | uses: actions/checkout@v4 69 | - uses: ./ 70 | with: 71 | build: stable 72 | package_root: test/dummy-syntax 73 | dummy_syntaxes: text.dummy 74 | 75 | st3: 76 | name: Without default packages, ST3 77 | runs-on: ubuntu-latest 78 | steps: 79 | - uses: actions/checkout@v4 80 | - uses: ./ 81 | with: 82 | build: 3210 83 | default_packages: v3189 84 | package_root: test/st3 85 | 86 | st3_no_defpkg_old_runtime: 87 | name: Without default packages, ST3, ubuntu-22.04 88 | runs-on: ubuntu-22.04 89 | steps: 90 | - uses: actions/checkout@v4 91 | - uses: ./ 92 | with: 93 | build: 3210 94 | package_root: test/no_defpkg 95 | 96 | # The following jobs are expected to error and used to test the error wrapper 97 | error: 98 | name: Error on purpose 99 | runs-on: ubuntu-latest 100 | steps: 101 | - uses: actions/checkout@v4 102 | - uses: ./ 103 | continue-on-error: true 104 | with: 105 | # The format was changed in build 4181 106 | build: 4189 107 | default_packages: master 108 | package_root: test/st3 109 | 110 | error_old_format: 111 | name: Error on purpose (old format) 112 | runs-on: ubuntu-latest 113 | steps: 114 | - uses: actions/checkout@v4 115 | - uses: ./ 116 | continue-on-error: true 117 | with: 118 | build: 4180 119 | default_packages: master 120 | package_root: test/st3 121 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 FichteFoll 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sublime Text Syntax Test Action 2 | 3 | ![Tests](https://github.com/SublimeText/syntax-test-action/workflows/Tests/badge.svg) 4 | 5 | Run syntax tests on your Sublime Text syntax definitions 6 | using the ST syntax test binary. 7 | 8 | ## Usage 9 | 10 | ### Minimal Example 11 | 12 | ```yaml 13 | name: Syntax Tests 14 | 15 | on: 16 | push: 17 | paths: 18 | - '**.sublime-syntax' 19 | - '**/syntax_test_*' 20 | - '**.tmPreferences' 21 | pull_request: 22 | paths: 23 | - '**.sublime-syntax' 24 | - '**/syntax_test_*' 25 | - '**.tmPreferences' 26 | 27 | jobs: 28 | syntax_tests: 29 | name: Syntax Tests (${{ matrix.build }}) 30 | runs-on: ubuntu-latest 31 | timeout-minutes: 15 # default is 6 hours! 32 | strategy: 33 | matrix: 34 | include: 35 | - build: latest # This is the default 36 | # packages: master # If you depend on a default syntax definition 37 | - build: stable # Fetches the binary for the latest stable build 38 | # packages: binary # Use respective tag for the selected binary build. 39 | - build: 3210 # Latest known ST3 build with a test binary 40 | # packages: v3189 # Latest ST3 tag on the Packages repo 41 | steps: 42 | - uses: actions/checkout@v4 43 | - uses: SublimeText/syntax-test-action@v2 44 | with: 45 | build: ${{ matrix.build }} 46 | # default_packages: ${{ matrix.packages }} 47 | ``` 48 | 49 | ### Multiple Syntax Package Tests Example 50 | 51 | ```yaml 52 | name: Multi Package Syntax Tests 53 | 54 | on: 55 | push: 56 | paths: 57 | - '**.sublime-syntax' 58 | - '**/syntax_test_*' 59 | - '**.tmPreferences' 60 | pull_request: 61 | paths: 62 | - '**.sublime-syntax' 63 | - '**/syntax_test_*' 64 | - '**.tmPreferences' 65 | 66 | jobs: 67 | syntax_tests: 68 | name: Syntax Tests (${{ matrix.build }}) 69 | runs-on: ubuntu-latest 70 | timeout-minutes: 15 # default is 6 hours! 71 | env: 72 | package_name: My Package # install name as specified at packagecontrol.io 73 | strategy: 74 | matrix: 75 | include: 76 | - build: latest # This is the default 77 | packages: master # default packages revision to use 78 | less_ref: master # Less package revision to use 79 | sass_ref: master # Sass package revision to use 80 | - build: 3211 # Latest known ST3 build with a test binary 81 | packages: v3211 # default packages revision to use 82 | less_ref: master # Less package revision to use 83 | sass_ref: master # Sass package revision to use 84 | steps: 85 | # Checkout primary package of this repository 86 | # and all additionally required packages next to each other 87 | # by specifying `path` for all. 88 | # `path` should match the package's name from packagecontrol.io 89 | # as this may be relevant for a package to work porperly. 90 | - name: Checkout ${{ env.package_name }} (primary package) 91 | uses: actions/checkout@v4 92 | with: 93 | path: ${{ env.package_name }} 94 | - name: Checkout Less (dependency) 95 | uses: actions/checkout@v4 96 | with: 97 | repository: SublimeText/Less 98 | ref: ${{ matrix.less_ref }} 99 | path: Less 100 | - name: Checkout Sass/Scss (dependency) 101 | uses: actions/checkout@v4 102 | with: 103 | repository: SublimeText/Sass 104 | ref: ${{ matrix.sass_ref }} 105 | path: Sass 106 | # Run syntax test for primary package 107 | # after installing default and additional packages 108 | - name: Run Syntax Tests for Sublime Text ${{ matrix.build }} 109 | uses: SublimeText/syntax-test-action@v2 110 | with: 111 | build: ${{ matrix.build }} 112 | package_name: ${{ env.package_name }} 113 | package_root: ${{ env.package_name }} 114 | default_packages: ${{ matrix.packages }} 115 | default_tests: false # default 116 | additional_packages: Dummy,Less,Sass 117 | additional_tests: false # default 118 | # External syntax definitions, 119 | # which are embedded without being tested in detail, 120 | # can be created as empty dummies 121 | # to just ensure their main scope is available. 122 | dummy_syntaxes: source.livescript,source.postcss,source.sss,source.stylus 123 | ``` 124 | 125 | > **Note** 126 | > You must use a separate job 127 | > if you want to test multiple ST build 128 | > or default packages versions. 129 | 130 | > **Warning** 131 | > It is important that you checkout your dependencies 132 | > to a folder that is separate from your `package_root`, 133 | > otherwise the dependency packages placed in a subfolder 134 | > would be treated (and tested) as a part of your package. 135 | 136 | 137 | ## Inputs 138 | 139 | | Name | Default | Description | 140 | | :----------------------- | :-------------- | :---------- | 141 | | **build** | `"latest"` | ST build that should be installed as an integer. `"latest"` is for the dev channel, `"stable"` for the stable channel. Not all builds are available. | 142 | | **default\_packages** | `"false"` | Install the [default packages][] and which version. Accepts any git ref, e.g. `"master"`, or `"binary"` for the tag of the respective binary. Note that the corresponding tag may not always exist. | 143 | | **default\_tests** | `false` | Whether to keep the tests of the default packages. | 144 | | **additional\_packages** | `""` | Comma-separated list of paths to additionally checked out packages to install (e.g.: `LESS,third-party/Sass`). Uses the folders' base names as the package names to install as. | 145 | | **additional\_tests** | `false` | Whether to keep the tests of the additional packages. | 146 | | **package\_root** | `"."` | Path to the package root that is linked to the testing Packages folder. | 147 | | **package\_name** | Repository name | Name to install the package as. | 148 | | **dummy\_syntaxes** | `""` | Comma-separated list of base scopes to create empty syntaxes for, e.g. `source.postcss,source.stylus`. | 149 | 150 | [default packages]: https://github.com/sublimehq/Packages/ 151 | 152 | 153 | ## Changelog 154 | 155 | ### v2 156 | 157 | ### v2.5 (2025-04-10) 158 | 159 | - Added support for the new syntax test output format of build 4181. 160 | (@michaelblyons, #24, #25) 161 | - Added support for multi-line error messages with the new format. 162 | (@FichteFoll, #29) 163 | - Added warnings for incorrectly named syntax test files 164 | that the syntax test binary will ignore. 165 | (@michaelblyons, #26, #27) 166 | 167 | ### v2.4 (2025-01-12) 168 | 169 | - Added `dummy_syntaxes` input that creates empty syntax files 170 | to satisfy external `embed`s that would otherwise result in CI failures. 171 | (@FichteFoll, #13, #20) 172 | - Added ability to specify `stable` for the `build` input, 173 | which automatically determines the latest stable build. 174 | (@FichteFoll, #21, #6) 175 | - Added ability to specify `binary` for the `default_packages` input, 176 | which automatically resolves to the closest tag on the repository. 177 | (@FichteFoll, #21) 178 | 179 | ### v2.3 (2025-01-11) 180 | 181 | - Fix dependencies for `ubuntu-24.04` runner. 182 | (@deathaxe, #17, #18) 183 | 184 | ### v2.2 (2023-01-08) 185 | 186 | - Support linking of multiple additional third-party packages 187 | via `additional_packages` and `additional_tests`. 188 | (@deathaxe, #12, #16) 189 | 190 | ### v2.1 (2021-06-07) 191 | 192 | - Treat `'latest'` as an ST4 build now that the upstream URL has been updated. 193 | (@FichteFoll) 194 | - Group dependency installation, if necessary. 195 | (@FichteFoll) 196 | 197 | ### v2.0 (2020-08-28) 198 | 199 | - Updated to new upstream download paths. (@FichteFoll) 200 | - Does not fetch dependencies anymore for 4077+. (@FichteFoll, #2) 201 | - Changed from docker to composite action. (@FichteFoll) 202 | 203 | ### v1 (2020-06-07) 204 | 205 | Initial working version 206 | supporting ST3 and ST4 builds 207 | as well as fetching the default packages. 208 | (@FichteFoll) 209 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Sublime Text Syntax Tests 2 | author: FichteFoll 3 | description: Install and run Sublime Text's syntax test runner 4 | branding: 5 | icon: check-circle 6 | color: orange 7 | 8 | inputs: 9 | additional_packages: 10 | description: Comma separated list of additional package roots that are linked to the testing Packages folder 11 | required: false 12 | default: '' 13 | additional_tests: 14 | description: Whether to keep the tests of additional packages 15 | required: false 16 | default: false 17 | build: 18 | description: Build that should be installed. Not all builds are available 19 | required: false 20 | default: latest 21 | default_packages: 22 | description: Install the default packages and which version (accepts any git ref) 23 | required: false 24 | default: false 25 | default_tests: 26 | description: Whether to keep the tests of the default packages 27 | required: false 28 | default: false 29 | dummy_syntaxes: 30 | description: Comma-separated list of base scopes to create empty syntaxes for 31 | required: false 32 | default: '' 33 | package_name: 34 | description: Name to install the package as 35 | required: false 36 | default: ${{ github.event.repository.name }} # github.repository has full name 37 | package_root: 38 | description: Path to the package root that is linked to the testing Packages folder 39 | required: false 40 | default: . 41 | 42 | outputs: {} 43 | 44 | runs: 45 | using: composite 46 | steps: 47 | - name: Install dependencies 48 | # composite steps don't support `if` 49 | run: | 50 | if [[ ${{ inputs.build }} < 4077 ]]; then 51 | echo "::group::Installing dependencies" 52 | sudo apt-get update && sudo apt-get install -y \ 53 | libcairo2 \ 54 | libgl1 \ 55 | libglx-mesa0 \ 56 | libglib2.0-0 \ 57 | libglu1-mesa \ 58 | libgtk-3-0 \ 59 | libpango-1.0-0 \ 60 | libpangocairo-1.0-0; 61 | echo '::endgroup::' 62 | fi 63 | shell: bash 64 | - name: Download and run syntax tests 65 | run: ${{ github.action_path }}/syntax-tests.sh 66 | shell: bash 67 | env: 68 | # composite actions don't expose input variables by default for some reason (unlike docker actions) 69 | INPUT_ADDITIONAL_PACKAGES: ${{ inputs.additional_packages }} 70 | INPUT_ADDITIONAL_TESTS: ${{ inputs.additional_tests }} 71 | INPUT_BUILD: ${{ inputs.build }} 72 | INPUT_DEFAULT_PACKAGES: ${{ inputs.default_packages }} 73 | INPUT_DEFAULT_TESTS: ${{ inputs.default_tests }} 74 | INPUT_DUMMY_SYNTAXES: ${{ inputs.dummy_syntaxes }} 75 | INPUT_PACKAGE_NAME: ${{ inputs.package_name }} 76 | INPUT_PACKAGE_ROOT: ${{ inputs.package_root }} 77 | -------------------------------------------------------------------------------- /syntax-tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -o pipefail 4 | 5 | # folder=".syntax-test-action" 6 | folder="$RUNNER_WORKSPACE/syntax_tests" 7 | packages="$folder/Data/Packages" 8 | mkdir -p "$folder" 9 | 10 | resolve_build() { 11 | local stable_check_url="https://www.sublimetext.com/updates/4/stable_update_check" 12 | local dev_check_url="https://www.sublimetext.com/updates/4/dev_update_check" 13 | local build="$INPUT_BUILD" 14 | 15 | if [[ $INPUT_BUILD == stable ]]; then 16 | build="$(curl -s "$stable_check_url" | jq '.latest_version')" 17 | echo >&2 "Latest stable build: $build" 18 | elif [[ $INPUT_BUILD == latest ]]; then 19 | build="$(curl -s "$dev_check_url" | jq '.latest_version')" 20 | echo >&2 "Latest dev build: $build" 21 | fi 22 | echo "$build" 23 | } 24 | 25 | get_url() { 26 | # Note: The syntax_tests binary for the latest build may not necessarily exist. 27 | # Fetching from https://download.sublimetext.com/latest/dev/linux/x64/syntax_tests 28 | # would be more reliable 29 | # but makes using the same build for the default Packages tag harder. 30 | local build="$1" 31 | local template_3000="https://download.sublimetext.com/st3_syntax_tests_build_%s_x64.tar.bz2" 32 | local template_4000="https://download.sublimetext.com/st_syntax_tests_build_%s_x64.tar.bz2" 33 | local template_4079="https://download.sublimetext.com/st_syntax_tests_build_%s_x64.tar.xz" 34 | 35 | case $build in 36 | 3*) printf "$template_3000\n" "$build";; 37 | 4*) if (( build < 4079 )); then 38 | printf "$template_4000\n" "$build"; 39 | else 40 | printf "$template_4079\n" "$build"; 41 | fi;; 42 | *) echo >&2 "Invalid build reference: $build"; exit 100;; 43 | esac 44 | } 45 | 46 | fetch_binary() { 47 | read -r url 48 | local tmpdir 49 | tmpdir="$(mktemp -d)" 50 | pushd "$tmpdir" 51 | wget --content-disposition "$url" 52 | tar xf st*_syntax_tests_build_*_x64.tar.* 53 | mv st*_syntax_tests/* "$folder" 54 | mkdir -vp "$packages" 55 | popd 56 | rm -rf "$tmpdir" 57 | } 58 | 59 | fetch_default_packages() { 60 | local binary_build="$1" 61 | local ref="$INPUT_DEFAULT_PACKAGES" 62 | if [[ $INPUT_DEFAULT_PACKAGES == false ]]; then 63 | echo '::debug::Skipping default packages' 64 | return 65 | fi 66 | if [[ $INPUT_DEFAULT_PACKAGES == binary ]]; then 67 | tag_build="$(get_closest_tag "$binary_build")" 68 | ref="v$tag_build" 69 | echo "Using closest tag to binary version: $ref" 70 | fi 71 | 72 | echo "::group::Fetching default packages (ref: $ref, tests: $INPUT_DEFAULT_TESTS)" 73 | pushd "$(mktemp -d)" 74 | wget --content-disposition "https://github.com/sublimehq/Packages/archive/$ref.tar.gz" 75 | tar xf Packages-*.tar.gz 76 | if [[ $INPUT_DEFAULT_TESTS != true ]]; then 77 | find Packages-*/ -type f -name 'syntax_test*' -exec rm -v '{}' \; 78 | fi 79 | find Packages-*/ \ 80 | -type d \ 81 | -maxdepth 1 \ 82 | -mindepth 1 \ 83 | -not -name '.github' \ 84 | -exec mv -vt "$packages/" '{}' + 85 | popd 86 | echo '::endgroup::' 87 | } 88 | 89 | get_closest_tag() { 90 | local base="$1" 91 | git ls-remote --tags https://github.com/sublimehq/Packages.git "refs/tags/v????" \ 92 | | cut -f2 \ 93 | | cut -d'v' -f2 \ 94 | | awk "{ if (\$1 <= $base) { print \$1 } }" \ 95 | | sort -r \ 96 | | head -n1 97 | } 98 | 99 | link_package() { 100 | echo 'Linking package' 101 | ln -vs "$(realpath "$INPUT_PACKAGE_ROOT")" "$packages/$INPUT_PACKAGE_NAME" 102 | } 103 | 104 | link_additional_packages() { 105 | if [[ -z $INPUT_ADDITIONAL_PACKAGES ]]; then 106 | return 107 | fi 108 | IFS="," 109 | for pkg in $INPUT_ADDITIONAL_PACKAGES; do 110 | # link additional package into testing dir's Package folder 111 | echo "Linking third-party package from '$pkg'" 112 | ln -vs "$(realpath "$pkg")" "$packages/$(basename "$pkg")" 113 | # drop additional syntax tests 114 | if [[ $INPUT_ADDITIONAL_TESTS != true ]]; then 115 | find "$(realpath "$pkg")" -type f -name 'syntax_test*' -exec rm -v '{}' \; 116 | fi 117 | done 118 | } 119 | 120 | create_dummy_syntaxes() { 121 | if [[ -z $INPUT_DUMMY_SYNTAXES ]]; then 122 | return 123 | fi 124 | IFS="," 125 | mkdir "$packages/_Dummy" 126 | for scope in $INPUT_DUMMY_SYNTAXES; do 127 | # link additional package into testing dir's Package folder 128 | echo "Creating dummy syntax for scope '$scope'" 129 | cat << SYNTAX > "$packages/_Dummy/$scope.sublime-syntax" 130 | %YAML 1.2 131 | --- 132 | scope: $scope 133 | 134 | contexts: 135 | main: [] 136 | SYNTAX 137 | done 138 | } 139 | 140 | check_syntax_test_filenames() { 141 | echo "::group::Checking syntax test filenames" 142 | for path in $(find . -iname syntax_test*); do 143 | file="${path/$packages\/$INPUT_PACKAGE_NAME/$INPUT_PACKAGE_ROOT}" 144 | if echo "$file" | grep -v '/syntax_test_'; then 145 | echo "::warning file=$file::Syntax test filenames must begin with 'syntax_test_'" 146 | fi 147 | if head -n 1 "$path" | grep -vEq '.+\bSYNTAX TEST\b.+".+\.(sublime-syntax|tmLanguage)"'; then 148 | echo "::warning file=$file::Syntax test file format at https://www.sublimetext.com/docs/syntax.html#testing" 149 | fi 150 | done 151 | echo '::endgroup::' 152 | } 153 | 154 | parse_test_results() { 155 | while IFS='' read -r line; do 156 | # Reprint this line to make it visible in the logs. 157 | # Not necessary for the lines we include in the message segment below. 158 | echo "$line" 159 | 160 | ### Before 4181 161 | # /home/runner/work/syntax-test-action/syntax_tests/Data/Packages/syntax-test-action/test/defpkg/syntax_test_test:7:1: [source.python constant.language] does not match scope [text.test] 162 | 163 | ### Since 4181 164 | # /home/runner/work/syntax-test-action/syntax_tests/Data/Packages/syntax-test-action/syntax_test_js.js:8:8 165 | # error: scope does not match 166 | # 8 | param 167 | # 9 | // ^^^^^ - variable.parameter.function.js 168 | # | ^^^^^ these locations did not match 169 | # actual: 170 | # | ^^^^^ source.js meta.function.parameters.js meta.binding.name.js variable.parameter.function.js 171 | # 172 | # (error blocks are then terminated by a blank line) 173 | if [[ "$line" == "$packages/$INPUT_PACKAGE_NAME/"* ]]; then 174 | IFS=$':' read -r path row col message <<< "$line" 175 | file="${path/$packages\/$INPUT_PACKAGE_NAME/$INPUT_PACKAGE_ROOT}" 176 | 177 | if (( $build >= 4181 )); then 178 | IFS='' read -r msg_line 179 | IFS=$':' read -r logtype message <<< "$msg_line" 180 | 181 | # Collect lines with more details until the next blank line 182 | while IFS='' read -r detail_line; do 183 | if [ -z "$detail_line" ]; then 184 | break 185 | fi 186 | # Using a percent-encoded newline ('%0A') works as a line break 187 | # via https://github.com/actions/toolkit/issues/193 188 | message="$message%0A$detail_line" 189 | done 190 | fi 191 | # https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message 192 | echo "::${logtype:-error} file=$file,line=$row,col=$col::${message# }" 193 | fi 194 | done 195 | } 196 | 197 | ############################################################################### 198 | ############################################################################### 199 | ############################################################################### 200 | 201 | # TODO cache $folder/syntax_test if not latest or stable 202 | build="$(resolve_build)" 203 | echo "::group::Fetching binary (build $build)" 204 | get_url "$build" | fetch_binary 205 | echo '::endgroup::' 206 | 207 | # TODO cache $packages based on $INPUT_DEFAULT_PACKAGES not in (master, st3, binary) (or resolve ref to hash) 208 | fetch_default_packages "$build" 209 | 210 | link_package 211 | 212 | link_additional_packages 213 | 214 | create_dummy_syntaxes 215 | 216 | check_syntax_test_filenames 217 | 218 | # TODO There seems to be some add-matcher workflow command. 219 | # We could generate/adjust that to only catch files 220 | # in the installed package, 221 | # but we may not be able to rewrite the original root path. 222 | # https://github.com/rbialon/flake8-annotations/blob/master/index.js 223 | echo 'Running binary' 224 | "$folder/syntax_tests" | parse_test_results 225 | -------------------------------------------------------------------------------- /test/defpkg/Test.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | scope: text.test 4 | 5 | contexts: 6 | main: 7 | - match: test 8 | scope: meta.test 9 | push: scope:source.python 10 | -------------------------------------------------------------------------------- /test/defpkg/syntax_test_test: -------------------------------------------------------------------------------- 1 | # SYNTAX TEST "Test.sublime-syntax" 2 | 3 | # <- text.test 4 | test 5 | True 6 | # <- source.python constant.language 7 | -------------------------------------------------------------------------------- /test/dummy-syntax/Test.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | scope: text.test 4 | 5 | contexts: 6 | main: 7 | - match: '' 8 | embed: scope:text.dummy 9 | escape: $ 10 | -------------------------------------------------------------------------------- /test/dummy-syntax/syntax_test_test: -------------------------------------------------------------------------------- 1 | # SYNTAX TEST "Test.sublime-syntax" 2 | 3 | # <- text.test 4 | -------------------------------------------------------------------------------- /test/no_defpkg/Test.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | scope: text.test 4 | 5 | contexts: 6 | main: 7 | - match: test 8 | scope: meta.test 9 | -------------------------------------------------------------------------------- /test/no_defpkg/syntax_test_test: -------------------------------------------------------------------------------- 1 | # SYNTAX TEST "Test.sublime-syntax" 2 | 3 | # <- text.test 4 | test 5 | # <- text.test meta.test 6 | 7 | x 8 | # <- - meta 9 | -------------------------------------------------------------------------------- /test/st3/syntax_test_js.js: -------------------------------------------------------------------------------- 1 | // SYNTAX TEST "Packages/JavaScript/JavaScript.sublime-syntax" 2 | 3 | // The following test would work on ST4 4 | // but does not on ST3 due to requiring branching. 5 | // Negate to get the inverse result. 6 | 7 | abc = ( 8 | param 9 | // ^^^^^ - variable.parameter.function.js 10 | ) => 1 + 2 11 | 12 | xyz = ( 13 | param 14 | // ^^^^^ - variable.parameter.function.js 15 | ) => 8 + 9 16 | -------------------------------------------------------------------------------- /test/third-party/Test.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | scope: text.test 4 | 5 | contexts: 6 | main: 7 | - match: '' 8 | push: Packages/INI/INI.sublime-syntax 9 | -------------------------------------------------------------------------------- /test/third-party/syntax_test_test: -------------------------------------------------------------------------------- 1 | # SYNTAX TEST "Test.sublime-syntax" 2 | 3 | [section] 4 | #^^^^^^^ source.ini meta.section.ini 5 | --------------------------------------------------------------------------------