Skip to content

Commit bba9b73

Browse files
committed
make test workflow run
1 parent a252c8f commit bba9b73

1 file changed

Lines changed: 38 additions & 5 deletions

File tree

.github/workflows/test-daff-config.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
name: Daffodil Daff CLI
1+
name: Daffodil Daff Config
22

33
on:
4+
pull_request:
5+
branches:
6+
- develop
47
workflow_call:
58
inputs:
69
ref:
@@ -13,7 +16,7 @@ on:
1316
angular-version:
1417
required: false
1518
type: string
16-
default: '^20'
19+
description: "Angular version constraint (e.g. '^20'). Defaults to the @angular/core version in package.json."
1720
secrets:
1821
NX_KEY:
1922
required: true
@@ -28,7 +31,7 @@ env:
2831

2932
jobs:
3033
test:
31-
name: "daff CLI (${{ matrix.driver }}, @angular${{ inputs.angular-version }})"
34+
name: "daff.json (${{ matrix.driver }})"
3235
runs-on: ubuntu-latest
3336
services:
3437
verdaccio:
@@ -51,6 +54,18 @@ jobs:
5154
fetch-depth: 1
5255
ref: ${{ inputs.ref && inputs.ref || github.sha }}
5356

57+
- name: Resolve Angular version
58+
id: angular-version
59+
env:
60+
INPUT_VERSION: ${{ inputs.angular-version }}
61+
run: |
62+
if [ -n "$INPUT_VERSION" ]; then
63+
VERSION="$INPUT_VERSION"
64+
else
65+
VERSION=$(jq -r '.dependencies["@angular/core"]' package.json | sed -E 's/\.[0-9]+\.[0-9]+//g')
66+
fi
67+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
68+
5469
- uses: graycoreio/github-actions/setup-node@main
5570
with:
5671
node-version: ${{ inputs.node-version }}
@@ -106,17 +121,35 @@ jobs:
106121
echo "name=${DIR_NAME}" >> "$GITHUB_OUTPUT"
107122
echo "path=${{ env.WORK_DIR }}/${DIR_NAME}" >> "$GITHUB_OUTPUT"
108123
124+
- name: Restore cached base app
125+
id: cache-base-app
126+
uses: actions/cache/restore@v4
127+
with:
128+
path: ${{ steps.test-dir.outputs.path }}
129+
key: commerce-base-app-scss-standalone-${{ steps.angular-version.outputs.version }}
130+
109131
- name: Scaffold test app
132+
if: steps.cache-base-app.outputs.cache-hit != 'true'
133+
env:
134+
DIR_NAME: "${{ steps.test-dir.outputs.name }}"
110135
run: |
111136
rm -rf "${{ steps.test-dir.outputs.path }}"
112137
mkdir -p "${{ env.WORK_DIR }}"
138+
113139
cd "${{ env.WORK_DIR }}"
114-
npx -y @angular/cli@${{ inputs.angular-version }} new "${{ steps.test-dir.outputs.name }}" \
140+
npx -y @angular/cli@${{ steps.angular-version.outputs.version }} new "$DIR_NAME" \
115141
--style=scss \
116142
--skip-tests \
117143
--defaults
118144
119-
- name: Add @daffodil/commerce schematic
145+
- name: Cache base app
146+
if: steps.cache-base-app.outputs.cache-hit != 'true'
147+
uses: actions/cache/save@v4
148+
with:
149+
path: ${{ steps.test-dir.outputs.path }}
150+
key: commerce-base-app-scss-standalone-${{ steps.angular-version.outputs.version }}
151+
152+
- name: Add schematic
120153
working-directory: ${{ steps.test-dir.outputs.path }}
121154
run: |
122155
CI=true npx ng add @daffodil/commerce@${{ env.TEST_VERSION }} \

0 commit comments

Comments
 (0)