@suffolklitlab/alkiln 5.13.3-feat-random ā 5.13.3-feat-random-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/unit_tests.yml +1 -1
- package/CHANGELOG.md +28 -1
- package/action.yml +6 -8
- package/action_for_github_server/action.yml +31 -39
- package/lib/docassemble/setup.js +1 -3
- package/lib/run_cucumber.js +15 -54
- package/lib/setup/TestGenerator.js +48 -38
- package/lib/setup/generate.js +1 -1
- package/lib/setup/validate.js +1 -1
- package/lib/steps.js +8 -71
- package/lib/utils/Log.js +12 -9
- package/lib/utils/_alkiln-constrained_random_tests_old.js +49 -0
- package/lib/utils/reports.js +6 -7
- package/lib/utils/session_vars.js +10 -6
- package/package.json +13 -10
- package/tests/log_codes/check_codes.sh +3 -3
- package/tests/log_codes/log_code_expected_instances.txt +23 -1
- package/tests/unit_tests/constrained_random_answers/invalid.fixtures.js +46 -24
- package/tests/unit_tests/constrained_random_answers/invalid.test.js +22 -4
- package/tests/unit_tests/constrained_random_answers/valid.fixtures.js +129 -98
- package/tests/unit_tests/constrained_random_answers/valid.test.js +33 -13
package/CHANGELOG.md
CHANGED
|
@@ -43,7 +43,34 @@ Format:
|
|
|
43
43
|
-
|
|
44
44
|
-->
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
## [Unreleased]
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- Add the `constrained random answers` Step. You must put the Step in a "constrained random test generator" Scenario which goes in a "constrained random test generator" file - a `.feature` file that starts with "alkiln_random". The file **MUST have ONLY 1 Scenario per generator file** at the moment. The Step is pretty strict. If there are irregularities, it will probably fail, but it will fail quickly. It is flexible about number of tests, though, and will default to 1. Closes [#962](https://github.com/SuffolkLITLab/ALKiln/issues/962).
|
|
51
|
+
- Add `MAX_RANDOM_TESTS_PER_SCENARIO` optional environment variable for the above `constrained random answers` Step. Default value is `40` until we hear otherwise.
|
|
52
|
+
- Regular tests that have incorrect syntax will fail more quickly now - very near the start. So will invalid "constrained random test generator" files. This will be a little slower for GitHub Sandbox tests right now, but still faster than it has been in the past. Closes [#972](https://github.com/SuffolkLITLab/ALKiln/issues/972).
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- Improve report indentation and tweak styling.
|
|
57
|
+
- Clarify some logs, including addressing bite-sized issues like [#981](https://github.com/SuffolkLITLab/ALKiln/issues/981).
|
|
58
|
+
- The report now shows the name of every Step that gets run in a test.
|
|
59
|
+
|
|
60
|
+
### Internal
|
|
61
|
+
|
|
62
|
+
- Added: `lib/globals.js` file to hold some shared constant values across the framework. It should NOT manage state. We may want to change the name to `constants.js` or `global_contants.js`. Let's see how it serves us.
|
|
63
|
+
- Added: executable scripts for more setup steps - managing the artifacts path (at the start of a run) and validating and generating files.
|
|
64
|
+
- Changed: `Log` now prioritizes what folder it stores files in in this order:
|
|
65
|
+
1. Use the argument to use an existing folder and save that to runtime_config.json at root.
|
|
66
|
+
2. Use the argument to make a new folder with that name and save that to runtime_config.json at root.
|
|
67
|
+
3. Use the alread-existing folder name value in runtime_config.json at root
|
|
68
|
+
4. Create a new folder and save that to runtime_config.json at root
|
|
69
|
+
- Changed: Add `.error()` to `Log` for visual clarity when storing an error to throw later. We need to discuss this behavior and its return value. To make that work Logs can now get the `error` prop without throwing an error.
|
|
70
|
+
- Changed: the Story Table step now accepts multiple ids and stops at whatever id it reaches first. I highly recommend that only ALKiln generated tests use this feature. We may avoid documenting it unless authors ask for it.
|
|
71
|
+
- Changed: `.gitignore` and `.npmignore` more things
|
|
72
|
+
- Fixed: log codes checker obob.
|
|
73
|
+
- Fixed: updated `actions/upload-artifact@v3` to `actions/upload-artifact@v4`
|
|
47
74
|
|
|
48
75
|
## [5.13.4] - 2025-01-11
|
|
49
76
|
|
package/action.yml
CHANGED
|
@@ -106,10 +106,10 @@ runs:
|
|
|
106
106
|
run: |
|
|
107
107
|
log="š” ALK0024 INFO: Confirm environment variables"
|
|
108
108
|
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
109
|
-
vars_log='\nALKiln version is $ALKILN_VERSION\nRepo is "$REPO_URL"\nBranch ref is "$BRANCH_PATH"\nCustom MAX_SECONDS_FOR_SETUP is "$MAX_SECONDS_FOR_SETUP"\nCustom SERVER_RELOAD_TIMEOUT_SECONDS is "$SERVER_RELOAD_TIMEOUT_SECONDS"\nCustom MAX_RANDOM_TESTS_PER_SCENARIO is "$MAX_RANDOM_TESTS_PER_SCENARIO"\n'
|
|
109
|
+
vars_log='\nALKiln version is ${{ env.ALKILN_VERSION }}\nRepo is "${{ env.REPO_URL }}"\nBranch ref is "${{ env.BRANCH_PATH }}"\nCustom MAX_SECONDS_FOR_SETUP is "${{ env.MAX_SECONDS_FOR_SETUP }}"\nCustom SERVER_RELOAD_TIMEOUT_SECONDS is "${{ env.SERVER_RELOAD_TIMEOUT_SECONDS }}"\nCustom MAX_RANDOM_TESTS_PER_SCENARIO is "${{ env.MAX_RANDOM_TESTS_PER_SCENARIO }}"\n'
|
|
110
110
|
echo -e "$vars_log" >> "${{ env.DEBUG_PATH }}" && echo -e "$vars_log"
|
|
111
111
|
|
|
112
|
-
# Install ALKiln
|
|
112
|
+
# Install ALKiln during GitHub workflow
|
|
113
113
|
- name: "š” ALK0025 INFO: Set up node"
|
|
114
114
|
uses: actions/setup-node@v4
|
|
115
115
|
with:
|
|
@@ -122,19 +122,17 @@ runs:
|
|
|
122
122
|
npm install -g "@suffolklitlab/alkiln@$ALKILN_VERSION"
|
|
123
123
|
|
|
124
124
|
# Files prep
|
|
125
|
-
|
|
126
125
|
- shell: bash
|
|
127
126
|
env:
|
|
128
127
|
ARTIFACT_FOLDER: ${{ env.ARTIFACT_FOLDER }}
|
|
129
128
|
run: |
|
|
130
|
-
log="š”
|
|
129
|
+
log="š” ALK0275 INFO: Prepare repository test files"
|
|
131
130
|
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
132
131
|
alkiln-artifacts --path="${{ env.ARTIFACT_FOLDER }}"
|
|
133
132
|
alkiln-validate
|
|
134
133
|
alkiln-generate
|
|
135
134
|
|
|
136
135
|
# Install package on playground
|
|
137
|
-
|
|
138
136
|
# Don't rely on the environment's version of python
|
|
139
137
|
- uses: actions/setup-python@v5
|
|
140
138
|
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
|
|
@@ -156,15 +154,15 @@ runs:
|
|
|
156
154
|
long_log="\n\nāāā\nš¤ ALK0028 ERROR: Unable to create a Project on your server's testing account or pull your package into it. Check the messages above this line.\n\n"
|
|
157
155
|
echo -e "$long_log" >> "${{ env.DEBUG_PATH }}" && echo -e "$long_log"
|
|
158
156
|
|
|
159
|
-
# Server
|
|
160
|
-
- name: "š” ALK0029 INFO:
|
|
157
|
+
# Server installation
|
|
158
|
+
- name: "š” ALK0029 INFO: Try to install the GitHub package onto the GitHub sandbox server"
|
|
161
159
|
if: ${{ inputs.INSTALL_METHOD == 'server' }}
|
|
162
160
|
shell: bash
|
|
163
161
|
run: |
|
|
164
162
|
log="š” ALK0029 INFO: Install the GitHub package onto the server"
|
|
165
163
|
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
166
164
|
alkiln-server-install
|
|
167
|
-
- name: "š¤ ALK0030 ERROR: Unable to install the package"
|
|
165
|
+
- name: "š¤ ALK0030 ERROR: Unable to install the package on the GitHub sandbox server"
|
|
168
166
|
if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
|
|
169
167
|
shell: bash
|
|
170
168
|
run: |
|
|
@@ -51,36 +51,28 @@ runs:
|
|
|
51
51
|
run: |
|
|
52
52
|
log="š” ALK0018 INFO: Get path names with date and time"
|
|
53
53
|
timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
|
|
54
|
+
# Where to get the contents for the artifact
|
|
54
55
|
debug_dir="/tmp"
|
|
55
|
-
|
|
56
|
+
debug_logs_path="$debug_dir/alkiln_docker_logs-${timestamp}UTC.txt"
|
|
57
|
+
# Where to put the artifact
|
|
56
58
|
artifact_folder="alkiln_github_server-${timestamp}UTC"
|
|
59
|
+
echo "debug_logs_path: $debug_logs_path"
|
|
60
|
+
echo "artifact_folder: $artifact_folder"
|
|
57
61
|
|
|
58
62
|
mkdir -p "$debug_dir"
|
|
59
63
|
mkdir -p "$artifact_folder"
|
|
60
|
-
echo -e "$log" >> "$
|
|
64
|
+
echo -e "$log" >> "$debug_logs_path"
|
|
61
65
|
|
|
62
|
-
echo "
|
|
66
|
+
echo "DEBUG_LOGS_PATH=$debug_logs_path" >> $GITHUB_ENV
|
|
63
67
|
echo "GITHUB_SERVER_ARTIFACT_NAME=$artifact_folder" >> $GITHUB_ENV
|
|
64
68
|
|
|
65
|
-
- shell: bash
|
|
66
|
-
env:
|
|
67
|
-
GITHUB_SERVER_ARTIFACT_NAME: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
|
|
68
|
-
run: |
|
|
69
|
-
log="š” ALK0276 INFO: Prepare repository test files"
|
|
70
|
-
echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
|
|
71
|
-
alkiln-artifacts --path="${{ env.GITHUB_SERVER_ARTIFACT_NAME }}"
|
|
72
|
-
alkiln-validate
|
|
73
|
-
alkiln-generate
|
|
74
|
-
|
|
75
|
-
# These run twice. As before, this creates 2 artifact folders.
|
|
76
|
-
|
|
77
69
|
- shell: bash
|
|
78
70
|
env:
|
|
79
71
|
MAX_SECONDS_FOR_DOCKER: ${{ inputs.MAX_SECONDS_FOR_DOCKER }}
|
|
80
72
|
DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
|
|
81
73
|
run: |
|
|
82
74
|
log="š” ALK0001 INFO: Set environment variables"
|
|
83
|
-
echo -e "\n$log" >> "${{ env.
|
|
75
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
84
76
|
|
|
85
77
|
echo "MAX_SECONDS_FOR_DOCKER=$MAX_SECONDS_FOR_DOCKER" >> $GITHUB_ENV
|
|
86
78
|
echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
|
|
@@ -93,7 +85,7 @@ runs:
|
|
|
93
85
|
shell: bash
|
|
94
86
|
run: |
|
|
95
87
|
log="š” ALK0002 INFO: Create GitHub step output variables"
|
|
96
|
-
echo -e "\n$log" >> "${{ env.
|
|
88
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
97
89
|
echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DA_ADMIN_API_KEY" >> "$GITHUB_OUTPUT"
|
|
98
90
|
echo "DA_ADMIN_EMAIL=$DA_ADMIN_EMAIL" >> "$GITHUB_OUTPUT"
|
|
99
91
|
echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
|
|
@@ -104,19 +96,19 @@ runs:
|
|
|
104
96
|
shell: bash
|
|
105
97
|
run: |
|
|
106
98
|
log="š” ALK0003 INFO: Get config"
|
|
107
|
-
echo -e "\n$log" >> "${{ env.
|
|
99
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
108
100
|
|
|
109
101
|
mkdir /tmp/config
|
|
110
102
|
# Worth making this silent by defining a variable with > /dev/null...?
|
|
111
103
|
if [ -n "$CONFIG" ]
|
|
112
104
|
then
|
|
113
105
|
log2="š” ALK0004 INFO: The developer did provide a custom docassemble config file as an input into this action."
|
|
114
|
-
echo -e "\n$log2" >> "${{ env.
|
|
106
|
+
echo -e "\n$log2" >> "${{ env.DEBUG_LOGS_PATH }}" echo "$log2"
|
|
115
107
|
echo "$CONFIG" > /tmp/config/myconfig.yml
|
|
116
108
|
echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
|
|
117
109
|
else
|
|
118
110
|
log3="š” ALK0005 INFO: The developer did NOT provide a custom docassemble config file as an input into this action. Docassemble will use its default config."
|
|
119
|
-
echo -e "\n$log3" >> "${{ env.
|
|
111
|
+
echo -e "\n$log3" >> "${{ env.DEBUG_LOGS_PATH }}" echo "$log3"
|
|
120
112
|
echo "CONFIG_ARGS=" >> $GITHUB_ENV
|
|
121
113
|
fi
|
|
122
114
|
|
|
@@ -132,13 +124,13 @@ runs:
|
|
|
132
124
|
shell: bash
|
|
133
125
|
run: |
|
|
134
126
|
log="š” ALK0006 INFO: Determine docker logs visibility"
|
|
135
|
-
echo -e "\n$log" >> "${{ env.
|
|
127
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
136
128
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
|
137
129
|
echo "OUTPUT_DOCKER=$SHOW_DOCKER_OUTPUT" >> $GITHUB_ENV
|
|
138
|
-
echo -e "\n$SHOW_DOCKER_OUTPUT" >> "${{ env.
|
|
130
|
+
echo -e "\n$SHOW_DOCKER_OUTPUT" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
139
131
|
else
|
|
140
132
|
echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
|
|
141
|
-
echo -e "\nfalse" >> "${{ env.
|
|
133
|
+
echo -e "\nfalse" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
142
134
|
fi
|
|
143
135
|
|
|
144
136
|
# Messages about output
|
|
@@ -148,14 +140,14 @@ runs:
|
|
|
148
140
|
run: |
|
|
149
141
|
# š” ALK0007 INFO: ALKiln will now hide docker output
|
|
150
142
|
log="===\nš” ALK0007 INFO: ALKiln will now hide docker output to avoid possibly showing details about your config. If you want to get output to see more of what is going on, use \"with:\" and set the input \"SHOW_DOCKER_OUTPUT\" to \"true\". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==="
|
|
151
|
-
echo -e "\n$log" >> "${{ env.
|
|
143
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
|
|
152
144
|
- name: "š” ALK0008 INFO: ALKiln will show docker output"
|
|
153
145
|
if: ${{ env.OUTPUT_DOCKER == 'true' }}
|
|
154
146
|
shell: bash
|
|
155
147
|
run: |
|
|
156
148
|
# š” ALK0008 INFO: ALKiln will show docker output
|
|
157
149
|
log="===\nš” ALK0008 INFO: ALKiln will show docker output. ALKiln cannot control this output. If you want to prevent output, use \"with:\" and set the input \"SHOW_DOCKER_OUTPUT\" to \"false\". This output will only be visible to those who can already see the action output, like people with admin or write permissions.\n==="
|
|
158
|
-
echo -e "\n$log" >> "${{ env.
|
|
150
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
|
|
159
151
|
|
|
160
152
|
# TODO: Reduce these to 1 block by putting ` > /dev/null 2>&1` into an env var
|
|
161
153
|
# No docker output
|
|
@@ -166,7 +158,7 @@ runs:
|
|
|
166
158
|
shell: bash
|
|
167
159
|
run: |
|
|
168
160
|
log="š” ALK0009 INFO: Download and start docker silently"
|
|
169
|
-
echo -e "\n$log" >> "${{ env.
|
|
161
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
170
162
|
docker pull jhpyle/docassemble > /dev/null 2>&1
|
|
171
163
|
docker run --name docassemble_container \
|
|
172
164
|
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
|
|
@@ -183,7 +175,7 @@ runs:
|
|
|
183
175
|
shell: bash
|
|
184
176
|
run: |
|
|
185
177
|
log="š” ALK0010 INFO: Download and start docker"
|
|
186
|
-
echo -e "\n$log" >> "${{ env.
|
|
178
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
187
179
|
docker pull jhpyle/docassemble
|
|
188
180
|
docker run --name docassemble_container \
|
|
189
181
|
--env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
|
|
@@ -201,13 +193,13 @@ runs:
|
|
|
201
193
|
run: |
|
|
202
194
|
# š” ALK0011 INFO: The following messages are not docker output
|
|
203
195
|
log="š” ALK0011 INFO: The following messages are NOT docker output, just ALKiln waiting for the server to start"
|
|
204
|
-
echo -e "\n$log" >> "${{ env.
|
|
196
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
|
|
205
197
|
|
|
206
198
|
- name: "š” ALK0012 INFO: Waiting for server to start"
|
|
207
199
|
shell: bash
|
|
208
200
|
run: |
|
|
209
201
|
log="š” ALK0012 INFO: Waiting for server to start"
|
|
210
|
-
echo -e "\n$log" >> "${{ env.
|
|
202
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
211
203
|
|
|
212
204
|
# Reset the SECONDS variable
|
|
213
205
|
SECONDS=0
|
|
@@ -217,27 +209,27 @@ runs:
|
|
|
217
209
|
response="start"
|
|
218
210
|
while [[ $response != *"200"* ]]; do
|
|
219
211
|
log2="š” ALK0013 INFO: Time elapsed: $SECONDS seconds"
|
|
220
|
-
echo -e "\n$log2" >> "${{ env.
|
|
212
|
+
echo -e "\n$log2" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log2"
|
|
221
213
|
|
|
222
214
|
# Check if max seconds till loading has passed
|
|
223
215
|
if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
|
|
224
216
|
log3="š¤ ALK0014 ERROR: Timed out waiting for docker container to serve the site. If you want to give your docker container more timem to install, set the MAX_SECONDS_FOR_DOCKER input for this action."
|
|
225
|
-
echo -e "\n$log3" >> "${{ env.
|
|
217
|
+
echo -e "\n$log3" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log3"
|
|
226
218
|
exit 1
|
|
227
219
|
fi
|
|
228
220
|
|
|
229
221
|
# Set the variable to a new string value in each iteration
|
|
230
222
|
response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
|
|
231
223
|
log4="š” ALK0015 INFO: Response is $response"
|
|
232
|
-
echo -e "\n$log4" >> "${{ env.
|
|
224
|
+
echo -e "\n$log4" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log4"
|
|
233
225
|
|
|
234
226
|
# Check if the string includes the desired text
|
|
235
227
|
if [[ $response == *"200"* ]]; then
|
|
236
228
|
log5="š” ALK0016 SUCCESS: Success! The docker container is ready!"
|
|
237
|
-
echo -e "\n$log5" >> "${{ env.
|
|
229
|
+
echo -e "\n$log5" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log5"
|
|
238
230
|
else
|
|
239
231
|
log6="š” ALK0017 INFO: The docker container is not ready yet. Will check again in 30 seconds."
|
|
240
|
-
echo -e "\n$log6" >> "${{ env.
|
|
232
|
+
echo -e "\n$log6" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log6"
|
|
241
233
|
sleep 30
|
|
242
234
|
fi
|
|
243
235
|
|
|
@@ -272,23 +264,23 @@ runs:
|
|
|
272
264
|
shell: bash
|
|
273
265
|
run: |
|
|
274
266
|
log="š” ALK0019 INFO: Create docker artifact data"
|
|
275
|
-
echo -e "\n$log" >> "${{ env.
|
|
276
|
-
echo "$(docker output docassemble_container)" >> "${{ env.
|
|
267
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
268
|
+
echo "$(docker output docassemble_container)" >> "${{ env.DEBUG_LOGS_PATH }}"
|
|
277
269
|
- name: "š” ALK0020 INFO: Upload artifacts folder"
|
|
278
270
|
if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
|
|
279
271
|
uses: actions/upload-artifact@v4
|
|
280
272
|
with:
|
|
281
273
|
name: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
|
|
282
|
-
path: ${{ env.
|
|
274
|
+
path: ${{ env.DEBUG_LOGS_PATH }}
|
|
283
275
|
|
|
284
276
|
- shell: bash
|
|
285
277
|
if: ${{ success() }}
|
|
286
278
|
run: |
|
|
287
279
|
log="š” ALK0021 SUCCESS: ALKiln created the docker container and started the server!"
|
|
288
|
-
echo -e "\n$log" >> "${{ env.
|
|
280
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
|
|
289
281
|
|
|
290
282
|
- shell: bash
|
|
291
283
|
if: ${{ failure() }}
|
|
292
284
|
run: |
|
|
293
285
|
log="š¤ ALK0022 ERROR: Something went wrong. See above for more details."
|
|
294
|
-
echo -e "\n$log" >> "${{ env.
|
|
286
|
+
echo -e "\n$log" >> "${{ env.DEBUG_LOGS_PATH }}" && echo -e "$log"
|
package/lib/docassemble/setup.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// rename? install_authors_docassemble_interview_package_on_server
|
|
4
|
-
|
|
5
3
|
const child_process = require(`child_process`);
|
|
6
4
|
|
|
7
5
|
const Log = require(`../utils/Log`);
|
|
@@ -56,7 +54,7 @@ const setup = async () => {
|
|
|
56
54
|
+ `dainstall this package on your server. See above for more details.`;
|
|
57
55
|
log.throw({ code: `ALK0047`, context,
|
|
58
56
|
before: `āļø āļø āļø Error data āļø āļø āļø\n`,
|
|
59
|
-
error: `Error while installing project` },
|
|
57
|
+
error: new Error(`Error while installing project on your docassemble server`) },
|
|
60
58
|
install_err_msg
|
|
61
59
|
);
|
|
62
60
|
}
|
package/lib/run_cucumber.js
CHANGED
|
@@ -10,34 +10,29 @@ const Log = require('./utils/Log');
|
|
|
10
10
|
const session_vars = require('./utils/session_vars');
|
|
11
11
|
const set_sources_paths = require(`./utils/set_sources_paths`);
|
|
12
12
|
|
|
13
|
-
// TODO: Remove after merging Log class
|
|
14
|
-
const files = require('./utils/files');
|
|
15
|
-
|
|
16
13
|
const SUMMARY_FILENAME = `cucumber-report.txt`;
|
|
17
14
|
|
|
18
15
|
|
|
19
|
-
function build_config(
|
|
16
|
+
function build_config() {
|
|
20
17
|
/** Use the command line arguments to build the cucumberjs config object.
|
|
21
18
|
*
|
|
22
19
|
* @param {string?} - Arguments passed to the command line.
|
|
23
20
|
*
|
|
24
21
|
* @returns {object} - cucumberjs config object
|
|
25
22
|
* */
|
|
26
|
-
// ========== TODO: Abstract after merging Log class PR
|
|
27
23
|
// Turn all the paths to the sources folders into paths to the feature files
|
|
28
24
|
let sources_paths = session_vars.get_sources_paths();
|
|
29
25
|
let feature_paths = [];
|
|
30
26
|
|
|
31
27
|
// Get all the paths for the right feature files (for cucumber to use)
|
|
32
28
|
for ( let sources_path of sources_paths ) {
|
|
33
|
-
// Ignore feature files that we parsed ourselves
|
|
34
29
|
let glob = fast_glob.sync(
|
|
35
30
|
`${ sources_path }/**/*.feature`,
|
|
31
|
+
// Ignore "generator" feature files that we used to generate actual tests
|
|
36
32
|
{ ignore: [`${ sources_path }/${ globals.generators_prefix }*.feature`] }
|
|
37
33
|
);
|
|
38
34
|
feature_paths.push( ...glob );
|
|
39
35
|
}
|
|
40
|
-
// ========== Ends TODO: Abstract
|
|
41
36
|
|
|
42
37
|
const config = {
|
|
43
38
|
publishQuiet: true,
|
|
@@ -47,6 +42,7 @@ function build_config( cli_args ) {
|
|
|
47
42
|
retry: 1,
|
|
48
43
|
}
|
|
49
44
|
|
|
45
|
+
const cli_args = require(`minimist`)( process.argv.slice(2) );
|
|
50
46
|
// Normalize tag expressions, if there are any
|
|
51
47
|
// Joining and splitting handles both tags surrounded with `""` or those without `""`
|
|
52
48
|
let tags = cli_args[`_`].join(` `).split(` `);
|
|
@@ -83,30 +79,6 @@ async function main() {
|
|
|
83
79
|
log.info({ code: `ALK0049`, context: `pre_run environment` },
|
|
84
80
|
environment
|
|
85
81
|
);
|
|
86
|
-
|
|
87
|
-
// ========== TODO: Abstract after merging Log class PR
|
|
88
|
-
let artifacts_path = files.make_artifacts_folder();
|
|
89
|
-
session_vars.save_artifacts_path_name( artifacts_path );
|
|
90
|
-
|
|
91
|
-
// We'll use the user info to construct the possible paths to /sources
|
|
92
|
-
let id = session_vars.get_user_id();
|
|
93
|
-
// `project` is the name in the server docassemble "Project" page
|
|
94
|
-
let project = session_vars.get_user_project_name();
|
|
95
|
-
|
|
96
|
-
// process.argv is a list of strings of commands and args.
|
|
97
|
-
// If using `npm run cucumber` (as opposed to the bin commands),
|
|
98
|
-
// use `--` before `--sources=./foo`
|
|
99
|
-
const argv = require(`minimist`)( process.argv.slice(2), {
|
|
100
|
-
default: {
|
|
101
|
-
sources: [
|
|
102
|
-
`./docassemble/*/data/sources`, // In GitHub folder
|
|
103
|
-
`/usr/share/docassemble/files/playgroundsources/${id}/${project}/*.feature`, // From playground without S3
|
|
104
|
-
`/tmp/playgroundsources/${id}/${project}/*.feature` // From playground with S3
|
|
105
|
-
],
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// ========== Ends TODO: Abstract
|
|
110
82
|
|
|
111
83
|
const { runConfiguration } = await cucumber_api.loadConfiguration({
|
|
112
84
|
provided: build_config( argv ),
|
|
@@ -133,9 +105,9 @@ async function main() {
|
|
|
133
105
|
|
|
134
106
|
/** Write to files.
|
|
135
107
|
*
|
|
136
|
-
* Note:
|
|
137
|
-
* authors can focus on the info we give them, which they often miss
|
|
138
|
-
* the GitHub action.
|
|
108
|
+
* Note: Avoid adding to the purely report-focused files. Those are files
|
|
109
|
+
* where authors can focus on the info we give them, which they often miss
|
|
110
|
+
* in the GitHub action.
|
|
139
111
|
*/
|
|
140
112
|
|
|
141
113
|
if ( success ) {
|
|
@@ -153,29 +125,12 @@ async function main() {
|
|
|
153
125
|
const exitCode = success ? 0 : 50;
|
|
154
126
|
process.exitCode = exitCode;
|
|
155
127
|
|
|
156
|
-
/** TODO:
|
|
157
|
-
* randomly generated test file cleanup
|
|
158
|
-
* 1. Generate files into the sources folder
|
|
159
|
-
* 2. copy the randomly generated files into the artifacts folder
|
|
160
|
-
* 3. MVP: delete the randomly generated files from the sources folder
|
|
161
|
-
* 4. post MVP: let the author keep the randomly generated tests in the
|
|
162
|
-
* sources folder and make a PR with them
|
|
163
|
-
* */
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Loop through sources folders
|
|
167
|
-
* If there are generated files in the generated files folder(s)
|
|
168
|
-
* delete that folder from the sources folders where we found them
|
|
169
|
-
* */
|
|
170
|
-
|
|
171
|
-
// This is hardcoded information from `provide_config` above.
|
|
172
|
-
// This code isn't used for anything other than detecting and removing color codes.
|
|
173
128
|
let summary_file_name = SUMMARY_FILENAME;
|
|
174
129
|
fs.readFile(summary_file_name, 'utf8', (read_error, text) => {
|
|
175
130
|
if ( read_error ) {
|
|
176
131
|
// Something else will probably show an error that's more relevant
|
|
177
132
|
log.warn({ code: `ALK0056`, context: `post_run error`, },
|
|
178
|
-
`Failed to read
|
|
133
|
+
`Failed to read the report of the 3rd party library, cucumberjs. There may be more information above or below.`, read_error
|
|
179
134
|
);
|
|
180
135
|
return;
|
|
181
136
|
}
|
|
@@ -210,7 +165,13 @@ async function main() {
|
|
|
210
165
|
try {
|
|
211
166
|
fs.readFileSync(`${ log.path }/${ log.unexpected_filename }`); // Does it have contents?
|
|
212
167
|
fs.appendFileSync(`${ log.path }/${ log.unexpected_filename }`, `\n\n\n\n\n` );
|
|
213
|
-
} catch ( ignore_err ) {
|
|
168
|
+
} catch ( ignore_err ) {
|
|
169
|
+
/* Missing "unexpected results" file is ok */
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// TODO: Is this meant to write to the debug file or is this debug info
|
|
173
|
+
// really supposed to be in the "unexpected results" file? Or are these
|
|
174
|
+
// comments old?
|
|
214
175
|
|
|
215
176
|
// Add the heading for debug content
|
|
216
177
|
fs.appendFileSync( `${ log.path }/${ log.unexpected_filename }`,
|
|
@@ -224,7 +185,7 @@ async function main() {
|
|
|
224
185
|
|
|
225
186
|
} catch ( writing_cucumber_error ) {
|
|
226
187
|
let code = `ALK0182`;
|
|
227
|
-
let context = `post_run
|
|
188
|
+
let context = `post_run`
|
|
228
189
|
let msg = `Something probably went wrong earlier. See warnings and errors above. Skipped writing to ${ log.path }/${ log.debug_log_filename }.`;
|
|
229
190
|
try {
|
|
230
191
|
log.warn({ code, context, }, msg, writing_cucumber_error );
|