Skip to content

Commit

Permalink
Fix eslint and nixpkgs-fmt tests (#568)
Browse files Browse the repository at this point in the history
- Eslint: new `tools.runtimes` functionality requires explicitly
specifying runtime shims
- nixpkgs-fmt: transitive dependencies were no longer compatible with
the pinned runtime version. Bumped to KGV, see #436
- Adds additional debug logs since eslint has been failing more
frequently lately

This should fix the cross-repo tests since the new CLI versions will
require these changes.

**These tests will not pass until we get a new staging release with
Windows shim fixes. Will bump version and land after that's out.**
  • Loading branch information
TylerJang27 authored Nov 29, 2023
1 parent 4b2b8b2 commit bc24c45
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/actions/linter_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ runs:
PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }}
PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }}
SOURCERY_TOKEN: ${{ inputs.sourcery-token }}
DEBUG: Driver:nixpkgs-fmt:*
DEBUG: Driver:nixpkgs-fmt:*, Driver:eslint:*
5 changes: 4 additions & 1 deletion .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.1

# version used for local trunk runs and testing
cli:
version: 1.17.2
version: 1.17.3-beta.15

api:
address: api.trunk-staging.io:8443
Expand Down Expand Up @@ -79,3 +79,6 @@ tools:
enabled:
- clangd-indexing-tools@16.0.2
- clangd@16.0.2
runtimes:
# expose shims in .trunk/tools
- node
12 changes: 12 additions & 0 deletions linters/eslint/eslint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ const preCheck = (driver: TrunkLintDriver) => {
moveConfig(driver);
// TODO(Tyler): Cache node_modules between runs
try {
const trunkYamlPath = ".trunk/trunk.yaml";
const currentContents = driver.readFile(trunkYamlPath);
const newContents = currentContents.concat(`tools:
runtimes:
- node
`);
driver.writeFile(trunkYamlPath, newContents);

// NOTE(Tyler): It is slower to use the hermetic Trunk installation of the npm shim, but it is safer for more platforms
// and avoids unhelpful circular JSON error messages.
driver.debug("About to install shims");
Expand Down Expand Up @@ -49,6 +57,10 @@ const preCheck = (driver: TrunkLintDriver) => {
},
);
driver.debug(install);
if (install.status !== 0) {
driver.debug(install.stdout.toString());
driver.debug(install.stderr.toString());
}
} catch (err: any) {
console.warn("Error installing eslint deps");
console.warn(err);
Expand Down
2 changes: 1 addition & 1 deletion linters/nixpkgs-fmt/nixpkgs_fmt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const preCheck: TestCallback = (driver) => {
const currentContents = driver.readFile(trunkYamlPath);
const newContents = currentContents.concat(`runtimes:
enabled:
- rust@1.65.0
- rust@1.71.1
`);
driver.writeFile(trunkYamlPath, newContents);
};
Expand Down

0 comments on commit bc24c45

Please sign in to comment.