Skip to content

test: add test workflows for all 3 jquery projects #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{json,yml}]
indent_style = space
indent_size = 2
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly

# Group all dependabot version update PRs into one
groups:
github-actions:
applies-to: version-updates
patterns:
- "*"
40 changes: 40 additions & 0 deletions .github/workflows/jquery-migrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: jQuery Migrate

on:
pull_request:
push:
branches:
- main

env:
NODE_VERSION: 22.x

jobs:
build-and-test:
runs-on: ubuntu-latest
name: Test jQuery Migrate Integration
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-

- name: Install dependencies
run: npm install

- name: Run jQuery Migrate tests
working-directory: test/jquery-migrate
run: npm it
40 changes: 40 additions & 0 deletions .github/workflows/jquery-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: jQuery UI

on:
pull_request:
push:
branches:
- main

env:
NODE_VERSION: 22.x

jobs:
build-and-test:
runs-on: ubuntu-latest
name: Test jQuery UI Integration
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-

- name: Install dependencies
run: npm install

- name: Run jQuery UI tests
working-directory: test/jquery-ui
run: npm it
40 changes: 40 additions & 0 deletions .github/workflows/jquery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: jQuery

on:
pull_request:
push:
branches:
- main

env:
NODE_VERSION: 22.x

jobs:
build-and-test:
runs-on: ubuntu-latest
name: Test jQuery Integration
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: recursive

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-

- name: Install dependencies
run: npm install

- name: Run jQuery tests
working-directory: test/jquery
run: npm it
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "test/jquery"]
path = test/jquery
url = [email protected]:jquery/jquery.git
[submodule "test/jquery-migrate"]
path = test/jquery-migrate
url = [email protected]:jquery/jquery-migrate.git
[submodule "test/jquery-ui"]
path = test/jquery-ui
url = [email protected]:jquery/jquery-ui.git
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit $1
39 changes: 39 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"verbose": 2,
"hooks": {
"before:init": "npm test"
},
"git": {
"commitMessage": "chore(release): ${version}",
"requireBranch": "main",
"tagName": "${version}"
},
"npm": {
"publish": true
},
"github": {
"release": true,
"tokenRef": "JQUERY_GITHUB_TOKEN"
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
}
]
}
}
}
}
11 changes: 11 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
extends: [ "@commitlint/config-conventional" ],
rules: {
"subject-case": [ 2, "never", [ "upper-case" ] ],
"scope-case": [
2,
"always",
[ "lower-case", "camel-case", "kebab-case", "pascal-case" ]
]
}
};
29 changes: 25 additions & 4 deletions lib/readYAML.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// The path is expected to either be absolute or relative to the current working directory.

import { readFile, stat } from "node:fs/promises";
import { resolve } from "node:path";
import { parse } from "yaml";
import { resolve } from "node:path";

const CONFIG_VERSION = 1;
const DEFAULT_YAML_PATHS = [ "jtr.yml", "jtr.yaml" ];
export const CONFIG_VERSION = 1;
export const DEFAULT_YAML_PATHS = [ "jtr.yml", "jtr.yaml" ];

const rkebab = /-([a-z])/g;

Expand All @@ -22,7 +22,28 @@ export default async function readYAML( path ) {
return {};
}

const contents = await readFile( resolve( process.cwd(), path ), "utf8" );
if ( !path.endsWith( ".yml" ) && !path.endsWith( ".yaml" ) ) {
throw new Error( "Invalid configuration file. Expected a YAML file." );
}

let contents;

// Check if path is absolute
if ( path.startsWith( "/" ) || path.startsWith( "\\" ) || path.includes( ":" ) ) {
if ( !await stat( path ).catch( () => false ) ) {
throw new Error( `Configuration file not found: ${ path }` );
}

contents = await readFile( path, "utf8" );
} else {
path = resolve( process.cwd(), path );

if ( !await stat( path ).catch( () => false ) ) {
throw new Error( `Configuration file not found: ${ path }` );
}

contents = await readFile( path, "utf8" );
}
let config = await parse( contents );

if ( config.version !== CONFIG_VERSION ) {
Expand Down
Loading
Loading