Skip to content

Commit

Permalink
👷 Updates Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ekwoka committed Aug 1, 2024
1 parent 347eef2 commit 0fd39ed
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 115 deletions.
128 changes: 14 additions & 114 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,172 +19,72 @@ jobs:
id: ls
run: echo "packages=[$(ls -d packages/* | sed 's/[^[:alnum:]]/\\&/g' | sed 's/.*/"&",/' | tr -d '\n' | sed '$s/,$//')]" >> $GITHUB_OUTPUT

cache-modules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: latest
standalone: true
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
pnpm store path
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: |
${{ steps.pnpm-cache.outputs.STORE_PATH }}
${{ '**/node_modules' }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install Dependencies
shell: bash
run: pnpm i

- name: Prune Store
shell: bash
run: pnpm store prune

Lint:
runs-on: ubuntu-latest
needs: [collection-packages, cache-modules]
needs: [collection-packages]
strategy:
matrix:
package: ${{ fromJSON(needs.collection-packages.outputs.packages) }}
fail-fast: false
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: latest
standalone: true
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
pnpm store path
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Restore cached Modules
uses: actions/cache/restore@v3
with:
path: |
${{ steps.pnpm-cache.outputs.STORE_PATH }}
${{ '**/node_modules' }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install Dependencies
shell: bash
run: pnpm i
run_install: true

- name: Lint
run: pnpm run -C ${{ matrix.package }} lint:check
run: pnpm --filter @awesome-alpine/${{matrix.package}} lint:check

- name: Type Check
run: pnpm run -C ${{ matrix.package }} lint:types
run: pnpm --filter @awesome-alpine/${{matrix.package}} lint:types
continue-on-error: true # AlpineTS is still not fully typed

Test:
runs-on: ubuntu-latest
needs: [collection-packages, cache-modules]
needs: [collection-packages]
strategy:
matrix:
package: ${{ fromJSON(needs.collection-packages.outputs.packages) }}
fail-fast: false
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: latest
standalone: true
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
pnpm store path
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Restore cached Modules
uses: actions/cache/restore@v3
with:
path: |
${{ steps.pnpm-cache.outputs.STORE_PATH }}
${{ '**/node_modules' }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install Dependencies
shell: bash
run: pnpm i
run_install: true

- name: Test
run: pnpm run -C ${{ matrix.package }} test --run --reporter=verbose
run: pnpm --filter @awesome-alpine/${{matrix.package}} test --run --reporter=verbose

Build:
runs-on: ubuntu-latest
needs: [collection-packages, cache-modules]
needs: [collection-packages]
strategy:
matrix:
package: ${{ fromJSON(needs.collection-packages.outputs.packages) }}
fail-fast: false
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
pnpm store path
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Restore cached Modules
uses: actions/cache/restore@v3
with:
path: |
${{ steps.pnpm-cache.outputs.STORE_PATH }}
${{ '**/node_modules' }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install Dependencies
shell: bash
run: pnpm i
standalone: true
run_install: true

- name: Build Package
run: pnpm run -C ${{ matrix.package }} -r build
run: pnpm --filter @awesome-alpine/${{matrix.package}} -r build

check-success:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion packages/alpinets/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "alpinets",
"name": "@alpinets/alpinets",
"version": "0.0.1",
"description": "The rugged, minimal TypeScript framework",
"author": "Eric Kwoka <[email protected]> (https://thekwoka.net/)",
Expand Down
4 changes: 4 additions & 0 deletions packages/mask/tests/x-mask.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@ describe('x-mask', () => {
);
await type('input', '12');
expect($('input').value).toBe('(12');
// @ts-expect-error Tapping into untyped internals
expect(Alpine.$data($('input')).value).toBe('(12');

await type('input', '123');
expect($('input').value).toBe('(123) ');
// @ts-expect-error Tapping into untyped internals
expect(Alpine.$data($('input')).value).toBe('(123) ');

await type('input', '1234567890');
expect($('input').value).toBe('(123) 456-7890');
// @ts-expect-error Tapping into untyped internals
expect(Alpine.$data($('input')).value).toBe('(123) 456-7890');
});
it('masks initial x-model value', async () => {
Expand All @@ -84,6 +87,7 @@ describe('x-mask', () => {
`,
);
expect($('input').value).toBe('(123) 456-7890');
// @ts-expect-error Tapping into untyped internals
expect(Alpine.$data($('input')).value).toBe('(123) 456-7890');
});
it('does nothing with falsy input', async () => {
Expand Down

0 comments on commit 0fd39ed

Please sign in to comment.