Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,37 @@ jobs:
uses: actions/checkout@v4
- uses: DeterminateSystems/determinate-nix-action@v3
- uses: DeterminateSystems/flakehub-cache-action@main
- run: nix develop -c action-validator -v ./.github/workflows/workflow.yml
- run: nix develop -c prettier --check .

- name: Validate workflow
run: nix develop -c action-validator -v ./.github/workflows/workflow.yml

- name: Get npm cache directory
id: npm-cache-directory
run: |
echo "directory=$(nix develop --command npm config get cache | tr -d '\n')" >> $GITHUB_OUTPUT

- name: Set up npm cache
uses: actions/cache@v5
with:
path: ${{ steps.npm-cache-directory.outputs.directory }}
key: ${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-cache

- name: Install npm dependencies
run: nix develop --command npm ci

- name: Lint
run: nix develop --command npm run lint

- name: Build
run: nix develop --command npm run build

- name: Check git status
run: git status --porcelain=v1

- name: Ensure no staged changes
run: git diff --exit-code

DeterminateCI:
uses: ./.github/workflows/workflow.yml
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ on:
required: false
default: true
type: boolean
flake-iter-flakeref:
description: |
Flake reference to use for the flake-iter process. Useful for pinning to specific versions should standards require it. Defaults to the latest release available on FlakeHub.
type: string
required: false
default: https://flakehub.com/f/DeterminateSystems/flake-iter/*
runner-map:
description: |
A custom mapping of [Nix system types](https://zero-to-nix.com/concepts/system-specificity) to desired Actions runners
Expand Down Expand Up @@ -104,10 +98,9 @@ jobs:
id: inventory
env:
FLAKE_ITER_RUNNER_MAP: ${{ toJson(fromJson(inputs.runner-map)) }}
FLAKE_ITER_FLAKEREF: ${{ inputs.flake-iter-flakeref }}
working-directory: ${{ inputs.directory }}
run: |
nix run "$FLAKE_ITER_FLAKEREF" -- systems
# NodeJS is always available on the runner
run: node ${{ github.workspace }}/dist/index.cjs
build:
runs-on: ${{ matrix.systems.runner }}
needs: inventory
Expand All @@ -131,9 +124,9 @@ jobs:
- name: Build for ${{ matrix.systems.nix-system }}
env:
FLAKE_ITER_NIX_SYSTEM: ${{ matrix.systems.nix-system }}
FLAKE_ITER_FLAKEREF: ${{ inputs.flake-iter-flakeref }}
working-directory: ${{ inputs.directory }}
run: nix run "$FLAKE_ITER_FLAKEREF" -- --verbose build
# NodeJS is always available on the runner
run: node ${{ github.workspace }}/dist/index.cjs

success:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
node_modules/
package-lock.json
3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

94 changes: 94 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import gitHubPlugin from "eslint-plugin-github";
import globals from "globals";
import tseslint from "typescript-eslint";

export default tseslint.config(
tseslint.configs.recommended,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},

ecmaVersion: 9,
sourceType: "module",
globals: {
...globals.node,
...globals.es2015,
},
},
},
{
settings: {
"import/resolver": {
typescript: {},
},
"import/parsers": {
"@typescript-eslint/parser": [".ts"],
},
},
},
gitHubPlugin.getFlatConfigs().recommended,
{
rules: {
"@typescript-eslint/no-base-to-string": "error",
camelcase: "error",
"i18n-text/no-en": "off",
"@typescript-eslint/no-shadow": "error",
"eslint-comments/no-use": "off",
"import/extensions": [
"error",
"ignorePackages",
{ json: "always", ts: "never" },
],
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
accessibility: "no-public",
},
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/unbound-method": "error",
},
},
);
29 changes: 7 additions & 22 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 8 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{
inputs = {
nixpkgs.url = "https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/*";

# For action-validator, which is broken with new rust versions
nixpkgs-old.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.717196";
};
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0";

outputs =
{ nixpkgs, nixpkgs-old, ... }:
{ self, ... }@inputs:
let
inherit (nixpkgs) lib;
inherit (inputs.nixpkgs) lib;

systems = [
"aarch64-linux"
Expand All @@ -18,26 +13,17 @@
];

forEachSystem =
f:
lib.genAttrs systems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgs-old = nixpkgs-old.legacyPackages.${system};
in
f { inherit pkgs pkgs-old; }
);
f: lib.genAttrs systems (system: f { pkgs = import inputs.nixpkgs { inherit system; }; });
in
{

devShells = forEachSystem (
{ pkgs, pkgs-old }:
{ pkgs }:
{
default = pkgs.mkShellNoCC {
buildInputs = [
pkgs.nodePackages.prettier

pkgs-old.action-validator
packages = with pkgs; [
nodejs_latest
action-validator
];
};
}
Expand Down
Loading
Loading