Skip to content

Commit

Permalink
ci: use upstream workflows for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed May 1, 2024
1 parent 3ff330f commit 5a3fe8d
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 118 deletions.
141 changes: 119 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,132 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- master
branches: ["*"]
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp
pull_request:
branches:
- "**" # Don't trust forks because miners
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
name: Test parser
runs-on: ${{matrix.os}}
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [macos-14, ubuntu-latest]
os: [ubuntu-latest, windows-latest, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Set up examples
run: |-
git clone https://github.com/JamesNK/Newtonsoft.Json examples/Newtonsoft.Json --single-branch --depth=1 --filter=blob:none
git clone https://github.com/nunit/nunit examples/nunit --single-branch --depth=1 --filter=blob:none
git clone https://github.com/OrchardCMS/orchard examples/orchard --single-branch --depth=1 --filter=blob:none
git clone https://github.com/microsoft/PowerToys examples/PowerToys --single-branch --depth=1 --filter=blob:none
- name: Run tests
uses: tree-sitter/parser-test-action@v2
with:
node-version: 18
- run: npm install
- run: npm test

test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
test-rust: ${{runner.os == 'Linux'}}
- name: Parse examples
uses: tree-sitter/parse-action@v4
id: test
continue-on-error: true
with:
files: |
examples/**/*.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Benchmarks/BenchmarkConstants.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Issues/Issue1569.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/LinqToSql/LinqToSqlClasses.designer.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/DependencyInjectionTests.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/WebApiIntegrationTests.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/TestObjects/Computer.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/TestObjects/DateTimeTestClass.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/TestObjects/DefaultValueAttributeTestClass.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/TestObjects/GeometricForms/Tags.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/TestObjects/Money/Tags.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/TestObjects/Pair.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/TestObjects/SqlTypesDataSet.Designer.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Utilities/EnumUtilsTests.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/UnixDateTimeConverter.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/FormatterAssemblyStyle.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonException.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReader.Async.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReaderException.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializationException.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonTextReader.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonValidatingReader.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonWriter.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/JsonWriterException.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JValue.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaException.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/FormatterConverter.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonPrimitiveContract.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DictionaryWrapper.cs
!examples/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/NullableAttributes.cs
!examples/PowerToys/src/settings-ui/Settings.UI.Library/Attributes/CmdConfigureIgnoreAttribute.cs
!examples/PowerToys/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs
!examples/nunit/src/NUnitFramework/framework/Assert.cs
!examples/nunit/src/NUnitFramework/framework/Compatibility/LongLivedMarshalByRefObject.cs
!examples/nunit/src/NUnitFramework/framework/Compatibility/StringSyntaxAttribute.cs
!examples/nunit/src/NUnitFramework/framework/Compatibility/System.Threading/ManualResetEventSlim.cs
!examples/nunit/src/NUnitFramework/framework/Compatibility/System.Web.UI/ICallbackEventHandler.cs
!examples/nunit/src/NUnitFramework/framework/Constraints/MsgUtils.cs
!examples/nunit/src/NUnitFramework/framework/ExceptionExtensions.cs
!examples/nunit/src/NUnitFramework/framework/Internal/CallerArgumentExpressionAttribute.cs
!examples/nunit/src/NUnitFramework/framework/Internal/ExceptionHelper.cs
!examples/nunit/src/NUnitFramework/framework/Internal/OSPlatform.cs
!examples/nunit/src/NUnitFramework/framework/Internal/PlatformHelper.cs
!examples/nunit/src/NUnitFramework/framework/Internal/Reflect.cs
!examples/nunit/src/NUnitFramework/framework/Internal/Results/TestResult.cs
!examples/nunit/src/NUnitFramework/framework/Internal/TestParameters.cs
!examples/nunit/src/NUnitFramework/nunitlite/Options.cs
!examples/nunit/src/NUnitFramework/testdata/Polyfills.cs
!examples/nunit/src/NUnitFramework/tests/Assertions/AssertThatTests.cs
!examples/nunit/src/NUnitFramework/tests/Assertions/WarningTests.cs
!examples/nunit/src/NUnitFramework/tests/AsyncExecutionApiAdapter.Fixture-based.FSharp.cs
!examples/nunit/src/NUnitFramework/tests/Attributes/ApartmentAttributeTests.cs
!examples/nunit/src/NUnitFramework/tests/Attributes/RepeatableTestsWithTimeoutAttributesTests.cs
!examples/nunit/src/NUnitFramework/tests/Attributes/RequiresThreadAttributeTests.cs
!examples/nunit/src/NUnitFramework/tests/Attributes/SingleThreadedFixtureTests.cs
!examples/nunit/src/NUnitFramework/tests/AwaitableReturnTypeTests.cs
!examples/nunit/src/NUnitFramework/tests/Internal/EventQueueTests.cs
!examples/nunit/src/NUnitFramework/tests/Internal/UnexpectedExceptionTests.cs
!examples/nunit/src/NUnitFramework/tests/NonVoidResultAwaitableReturnTypeTests.cs
!examples/nunit/src/NUnitFramework/tests/SynchronizationContextTests.cs
!examples/nunit/src/NUnitFramework/tests/Syntax/PathConstraintTests.cs
!examples/nunit/src/NUnitFramework/tests/TestUtilities/StressUtility.cs
!examples/orchard/src/Orchard/DisplayManagement/Shapes/Composite.cs
- uses: actions/upload-artifact@v4
if: steps.test.outputs.failures != ''
with:
node-version: 18
- run: npm install
- run: npm run-script test-windows
name: failures
path: ${{steps.test.outputs.failures}}
21 changes: 21 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Fuzz Parser

on:
push:
branches: [master]
paths:
- src/scanner.c
pull_request:
paths:
- src/scanner.c

jobs:
fuzz:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run fuzzer
uses: tree-sitter/fuzz-action@v4
with:
tree-sitter-version: v0.22.5
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
push:
branches: [master]
paths:
- grammar.js
pull_request:
paths:
- grammar.js

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version: ${{vars.NODE_VERSION}}
- name: Install modules
run: npm ci --legacy-peer-deps
- name: Run ESLint
run: npm run lint
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish package

on:
push:
tags: ["*"]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
npm:
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
secrets:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
crates:
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
secrets:
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}}
pypi:
uses: tree-sitter/workflows/.github/workflows/package-pypi.yml@main
secrets:
PYPI_API_TOKEN: ${{secrets.PYPI_API_TOKEN}}
33 changes: 0 additions & 33 deletions .github/workflows/publish_crate.yml

This file was deleted.

5 changes: 0 additions & 5 deletions script/file_sizes.txt

This file was deleted.

3 changes: 0 additions & 3 deletions script/known_failures.txt

This file was deleted.

45 changes: 0 additions & 45 deletions script/parse-examples

This file was deleted.

3 changes: 0 additions & 3 deletions script/update-file-sizes

This file was deleted.

7 changes: 0 additions & 7 deletions script/update-known-failures

This file was deleted.

0 comments on commit 5a3fe8d

Please sign in to comment.