Skip to content

Commit

Permalink
Add yarn test
Browse files Browse the repository at this point in the history
  • Loading branch information
ncalteen committed Mar 7, 2025
1 parent 21d6fb3 commit 2ceb049
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 50 deletions.
180 changes: 132 additions & 48 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: npm ci

- name: Check Format
id: format-check
id: format
run: npm run format:check

- name: Lint
Expand All @@ -45,15 +45,10 @@ jobs:
id: test
run: npm run ci-test

test-typescript-npm:
name: Test TypeScript Template (npm)
test-typescript-esm-npm:
name: Test TypeScript ESM Template (npm)
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: local-action

steps:
- name: Checkout @github/local-action
id: checkout
Expand All @@ -79,6 +74,7 @@ jobs:
- name: Install @github/local-action Dependencies
id: install
run: npm ci
working-directory: local-action

- name: Install TypeScript Template Dependencies
id: install-typescript
Expand All @@ -88,6 +84,7 @@ jobs:
- name: Link @github/local-action
id: link
run: npm link
working-directory: local-action

- name: Generate Dotenv File
id: dotenv
Expand All @@ -97,19 +94,14 @@ jobs:
working-directory: typescript-action

- name: Test TypeScript Action
id: test-typescript
id: test
run: npm run local-action
working-directory: typescript-action

test-javascript-npm:
name: Test JavaScript Template (npm)
test-javascript-esm-npm:
name: Test JavaScript ESM Template (npm)
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: local-action

steps:
- name: Checkout @github/local-action
id: checkout
Expand All @@ -135,6 +127,7 @@ jobs:
- name: Install @github/local-action Dependencies
id: install
run: npm ci
working-directory: local-action

- name: Install JavaScript Template Dependencies
id: install-javascript
Expand All @@ -144,6 +137,7 @@ jobs:
- name: Link @github/local-action
id: link
run: npm link
working-directory: local-action

- name: Generate Dotenv File
id: dotenv
Expand All @@ -153,35 +147,82 @@ jobs:
working-directory: javascript-action

- name: Test JavaScript Action
id: test-javascript
id: test
run: npm run local-action
working-directory: javascript-action

test-typescript-pnpm:
name: Test TypeScript Template (pnpm)
test-typescript-esm-pnpm:
name: Test TypeScript ESM Template (pnpm)
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: local-action

steps:
- name: Checkout @github/local-action
id: checkout
uses: actions/checkout@v4
with:
path: local-action

- name: Checkout TypeScript Template (ESM)
id: checkout-typescript-esm
- name: Checkout TypeScript Template
id: checkout-typescript
uses: actions/checkout@v4
with:
path: typescript-pnpm-esm-action
repository: ncalteen/typescript-pnpm-esm-action

- name: Checkout TypeScript Template (CJS)
id: checkout-typescript-cjs
- name: Install pnpm
id: pnpm
uses: pnpm/action-setup@v4
with:
version: latest

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: local-action/.node-version
cache: npm
cache-dependency-path: local-action/package-lock.json

- name: Install @github/local-action Dependencies
id: install
run: npm ci
working-directory: local-action

- name: Install TypeScript Template Dependencies
id: install-typescript
run: pnpm install
working-directory: typescript-pnpm-esm-action

- name: Link @github/local-action
id: link
run: pnpm link
working-directory: local-action

- name: Generate Dotenv File
id: dotenv
run: |
echo "ACTIONS_STEP_DEBUG=true" >> .env
echo "INPUT_MILLISECONDS=2400" >> .env
working-directory: typescript-pnpm-esm-action

- name: Test TypeScript Action
id: test
run: pnpm run local-action
working-directory: typescript-pnpm-esm-action

test-typescript-cjs-pnpm:
name: Test TypeScript CJS Template (pnpm)
runs-on: ubuntu-latest

steps:
- name: Checkout @github/local-action
id: checkout
uses: actions/checkout@v4
with:
path: local-action

- name: Checkout TypeScript Template
id: checkout-typescript
uses: actions/checkout@v4
with:
path: typescript-pnpm-cjs-action
Expand All @@ -204,41 +245,84 @@ jobs:
- name: Install @github/local-action Dependencies
id: install
run: npm ci
working-directory: local-action

- name: Install TypeScript Template Dependencies (ESM)
id: install-typescript-esm
run: pnpm install
working-directory: typescript-pnpm-esm-action

- name: Install TypeScript Template Dependencies (CJS)
id: install-typescript-cjs
- name: Install TypeScript Template Dependencies
id: install-typescript
run: pnpm install
working-directory: typescript-pnpm-cjs-action

- name: Link @github/local-action
id: link
run: pnpm link
working-directory: local-action

- name: Generate Dotenv File
id: dotenv-esm
id: dotenv
run: |
echo "ACTIONS_STEP_DEBUG=true" >> .env
echo "INPUT_MILLISECONDS=2400" >> .env
working-directory: typescript-pnpm-esm-action
working-directory: typescript-pnpm-cjs-action

- name: Test TypeScript Action
id: test
run: pnpm run local-action
working-directory: typescript-pnpm-cjs-action

test-typescript-esm-yarn:
name: Test TypeScript ESM Template (yarn)
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: local-action

steps:
- name: Checkout @github/local-action
id: checkout
uses: actions/checkout@v4
with:
path: local-action

- name: Checkout TypeScript Template
id: checkout-typescript
uses: actions/checkout@v4
with:
path: typescript-yarn-esm-action
repository: ncalteen/typescript-yarn-esm-action

- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: local-action/.node-version
cache: npm
cache-dependency-path: local-action/package-lock.json

- name: Install @github/local-action Dependencies
id: install
run: npm ci
working-directory: local-action

- name: Install TypeScript Template Dependencies
id: install-typescript
run: yarn install
working-directory: typescript-yarn-esm-action

- name: Link @github/local-action
id: link
run: yarn link
working-directory: local-action

- name: Generate Dotenv File
id: dotenv-cjs
id: dotenv
run: |
echo "ACTIONS_STEP_DEBUG=true" >> .env
echo "INPUT_MILLISECONDS=2400" >> .env
working-directory: typescript-pnpm-cjs-action

- name: Test TypeScript Action (ESM)
id: test-typescript-esm
run: pnpm run local-action
working-directory: typescript-pnpm-esm-action
working-directory: typescript-yarn-esm-action

- name: Test TypeScript Action (CJS)
id: test-typescript-cjs
run: pnpm run local-action
working-directory: typescript-pnpm-cjs-action
- name: Test TypeScript Action
id: test-typescript
run: yarn run local-action
working-directory: typescript-yarn-esm-action
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,35 @@ currently implemented by this tool.

See the [CHANGELOG](./CHANGELOG.md) for a complete list of changes.

## Package Manager Support

### `npm` Support

This tool is designed primarily for use with `npm` and `npx`. It is recommended
to use `npm` for managing actions you wish to test with this tool.

### `pnpm` Support

This tool ships with **experimental** support for `pnpm`. If you encounter any
issues, please file an issue
[here](https://github.com/github/local-action/issues).

Some caveats to this support are listed below.

- This tool does not support CommonJS actions using `pnpm`.

## `yarn` Support

This tool ships with **experimental** support for `pnpm`. If you encounter any
issues, please file an issue
[here](https://github.com/github/local-action/issues).

Some caveats to this support are listed below.

- The `@github/local-action` package should be run using
`yarn dlx @github/local-action` instead of `yarn local-action`.
- This tool does not support CommonJS actions using `yarn`.

## Prerequisites

### Installed Tools
Expand Down Expand Up @@ -83,8 +112,9 @@ the following when preparing for release:

- Commit the `node_modules` directory to your repository
- Transpile your code and dependencies using tools like
[`tsc`](https://www.typescriptlang.org/docs/handbook/compiler-options.html) or
[`@vercel/ncc`](https://www.npmjs.com/package/@vercel/ncc)
[`tsc`](https://www.typescriptlang.org/docs/handbook/compiler-options.html),
[`@vercel/ncc`](https://www.npmjs.com/package/@vercel/ncc), or
[`rollup`](https://rollupjs.org/)

**This tool supports non-transpiled action code only.** This is because it uses
[`quibble`](https://github.com/testdouble/quibble) to override GitHub Actions
Expand Down

0 comments on commit 2ceb049

Please sign in to comment.