@suffolklitlab/alkiln 5.13.2 → 5.13.3-feat-random

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.
Files changed (49) hide show
  1. package/.github/workflows/github_server.yml +7 -7
  2. package/.github/workflows/playground.yml +2 -1
  3. package/CHANGELOG.md +32 -1
  4. package/action.yml +89 -29
  5. package/action_for_github_server/action.yml +73 -29
  6. package/docs/4_environments.md +243 -0
  7. package/docs/artifacts_folder_name.md +135 -0
  8. package/docs/constrained_random_tests.md +254 -0
  9. package/docs/decisions/006_which_log_level_to_pick_2024_09_5.md +70 -0
  10. package/docs/decisions/007_getting_and_storing_logs.md +179 -0
  11. package/docs/decisions/move_runtime_config_to_sources_folder.md +5 -0
  12. package/docs/decisions/reports_and_logs_2024_08_11.md +161 -0
  13. package/docs/kinds_of_errors.md +26 -0
  14. package/docs/prioritize_constrained_random_tests.md +60 -0
  15. package/lib/docassemble/docassemble_api_interface.js +77 -51
  16. package/lib/docassemble/server_install.js +32 -9
  17. package/lib/docassemble/setup.js +41 -24
  18. package/lib/docassemble/takedown.js +33 -10
  19. package/lib/globals.js +10 -0
  20. package/lib/run_cucumber.js +155 -50
  21. package/lib/scope.js +101 -77
  22. package/lib/setup/TestGenerator.js +1745 -0
  23. package/lib/setup/artifacts.js +20 -0
  24. package/lib/setup/generate.js +42 -0
  25. package/lib/setup/get_Gherkin_AST.js +26 -0
  26. package/lib/setup/validate.js +89 -0
  27. package/lib/steps.js +176 -51
  28. package/lib/utils/Log.js +1132 -0
  29. package/lib/utils/_alkiln-constrained_random_tests_old.js +1727 -0
  30. package/lib/utils/files.js +18 -11
  31. package/lib/utils/get_error_stacks.js +16 -0
  32. package/lib/utils/reports.js +95 -28
  33. package/lib/utils/session_vars.js +102 -73
  34. package/lib/utils/set_sources_paths.js +98 -0
  35. package/lib/utils/time.js +44 -0
  36. package/package.json +16 -8
  37. package/tests/log_codes/check_codes.sh +19 -14
  38. package/tests/log_codes/log_code_expected_instances.txt +69 -9
  39. package/tests/unit_tests/constrained_random_answers/invalid.fixtures.js +155 -0
  40. package/tests/unit_tests/constrained_random_answers/invalid.test.js +233 -0
  41. package/tests/unit_tests/constrained_random_answers/valid.fixtures.js +905 -0
  42. package/tests/unit_tests/constrained_random_answers/valid.test.js +521 -0
  43. package/tests/unit_tests/example_of_chai_test_lifecycle.js +78 -0
  44. package/tests/unit_tests/getAllFields.test.js +5 -0
  45. package/tests/unit_tests/getMatchingRows.test.js +5 -0
  46. package/tests/unit_tests/log.test.js +557 -0
  47. package/tests/unit_tests/normalizeTable.test.js +5 -0
  48. package/lib/utils/log.js +0 -96
  49. /package/docs/{expected_inernal_results.md → expected_internal_results.md} +0 -0
@@ -45,15 +45,15 @@ jobs:
45
45
  #### keyword or values at all. See
46
46
  #### https://assemblyline.suffolklitlab.org/docs/alkiln/writing#env-vars
47
47
  env:
48
- SECRET_VAR1: secret-var1-value
49
- SECRET_VAR2: secret-var2-value
50
- SECRET_FOR_MISSING_FIELD: secret for missing field
51
- INVALID_API_KEY: invalidAPIkey
52
- EMPTY_STRING: ""
53
48
  NORMAL_USER_EMAIL: alkiln@example.com
54
49
  NORMAL_USER_PASSWORD: User123^
55
50
  WRONG_EMAIL: wrong_email@example.com
56
51
  WRONG_PASSWORD: wrong_password
52
+ INVALID_API_KEY: invalidAPIkey
53
+ EMPTY_STRING: ""
54
+ SECRET_VAR1: secret-var1-value
55
+ SECRET_VAR2: secret-var2-value
56
+ SECRET_FOR_MISSING_FIELD: secret for missing field
57
57
 
58
58
  steps:
59
59
  # Place the root directory in this branch to access
@@ -160,7 +160,7 @@ jobs:
160
160
  #### Developer note: You can probably leave the rest out
161
161
  #### To learn more, see https://assemblyline.suffolklitlab.org/docs/alkiln/writing/#optional-inputs
162
162
  ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
163
- ALKILN_VERSION: download
163
+ ALKILN_VERSION: random
164
164
 
165
165
  #### Developer note: Example of making an issue when tests fail
166
166
  #### that includes the text of the failure output file
@@ -169,7 +169,7 @@ jobs:
169
169
  if: ${{ failure() }}
170
170
  env:
171
171
  GH_TOKEN: ${{ github.token }}
172
- PATH_TO_REPORT_FILE: "${{ steps.alkiln.outputs.PATH_TO_REPORT_FILE }}"
172
+ PATH_TO_REPORT_LOG_FILE: "${{ steps.alkiln.outputs.PATH_TO_REPORT_LOG_FILE }}"
173
173
  PATH_TO_UNEXPECTED_RESULTS_FILE: "${{ steps.alkiln.outputs.PATH_TO_UNEXPECTED_RESULTS_FILE }}"
174
174
  PATH_TO_DEBUG_LOG_FILE: "${{ steps.alkiln.outputs.PATH_TO_DEBUG_LOG_FILE }}"
175
175
  run: |
@@ -76,9 +76,10 @@ jobs:
76
76
  DOCASSEMBLE_DEVELOPER_API_KEY: "${{ env.DOCASSEMBLE_DEVELOPER_API_KEY }}"
77
77
  #### Developer note: See https://assemblyline.suffolklitlab.org/docs/alkiln/writing/#optional-inputs
78
78
  #### You can probably leave this out
79
+ MAX_RANDOM_TESTS_PER_SCENARIO: 10
79
80
  # Internal: docassemble changes sometimes break @a11y tests. That is
80
81
  # a da problem, not ours. We will trigger these tests manually when we
81
82
  # want to check up on this.
82
83
  ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
83
84
  #### Developer note: You can probably leave this out
84
- ALKILN_VERSION: download
85
+ ALKILN_VERSION: random
package/CHANGELOG.md CHANGED
@@ -43,11 +43,36 @@ Format:
43
43
  -
44
44
  -->
45
45
 
46
- ## [Unreleased]
46
+ <!-- ## [Unreleased] -->
47
+
48
+ ## [5.13.4] - 2025-01-11
49
+
50
+ ### Changed
51
+
52
+ - Removed an extraneous log
53
+
54
+ ### Fixed
55
+
56
+ - Final error showed an undefined var instead of a more useful error message
57
+
58
+ ### Internal
59
+
60
+ - Refactored `log` into a class that works with ALKiln's 4 possible environments
61
+ - Refactored `Log` class to handle throwing errors
62
+ - Now store debug information in debug log instead of printing it live
63
+ - Removed debug flag so debug logs always get stored
64
+ - Added decision/design docs
65
+
66
+ ## [5.13.3] - 2025-01-05
67
+
68
+ ### Fixed
69
+
70
+ - Updates to latest docassemble HTML. See [#960](https://github.com/SuffolkLITLab/ALKiln/issues/960). Changes all appearances of `fieldset` to keep the code consistent.
47
71
 
48
72
  ## [5.13.2] - 2024-11-23
49
73
 
50
74
  ### Fixed
75
+
51
76
  - Fixes download Step unable to use a partial filename match. The Step needed the whole name, including the extension. See [#725](https://github.com/SuffolkLITLab/ALKiln/issues/725).
52
77
 
53
78
  ## [5.13.1] - 2024-10-23
@@ -59,6 +84,8 @@ Format:
59
84
  ### Fixed
60
85
 
61
86
  - Detects failed sign in. Closes [#918](https://github.com/SuffolkLITLab/ALKiln/issues/918).
87
+ - Fixes undefined `errors` var in `After()`
88
+ - Closes [#924](https://github.com/SuffolkLITLab/ALKiln/issues/924), remove extra interview url print
62
89
 
63
90
  ### Internal
64
91
 
@@ -69,6 +96,10 @@ Format:
69
96
  - Adds decision docs
70
97
  - Updated CONTRIBUTING.md
71
98
  - Added example.env, closes [#374](https://github.com/SuffolkLITLab/ALKiln/issues/374)
99
+ - Closes [#805](https://github.com/SuffolkLITLab/ALKiln/issues/805), create verbose-type log
100
+ - Closes [#659](https://github.com/SuffolkLITLab/ALKiln/issues/659), abstract adding to debug_log
101
+ - Closes [#925](https://github.com/SuffolkLITLab/ALKiln/issues/925), allow a `Log` to throw an error
102
+ - Addresses [#461](https://github.com/SuffolkLITLab/ALKiln/issues/461), setup and takedown reports
72
103
  - Updates pdfjs-dist for node v20 and v22. See [#952](https://github.com/SuffolkLITLab/ALKiln/issues/952).
73
104
 
74
105
  ## [5.13.0] - 2024-07-11
package/action.yml CHANGED
@@ -33,6 +33,10 @@ inputs:
33
33
  description: "The version of docassemblecli to install."
34
34
  required: false
35
35
  default: "0.0.17"
36
+ MAX_RANDOM_TESTS_PER_SCENARIO:
37
+ description: "The maximum number of tests ALKiln will generate for every Scenario that can generate tests."
38
+ required: false
39
+ # Default will be internal to avoid duplication of data
36
40
 
37
41
  outputs:
38
42
  PATH_TO_ARTIFACTS:
@@ -41,6 +45,9 @@ outputs:
41
45
  PATH_TO_REPORT_FILE:
42
46
  description: 'An empty string ("") or the path to report.txt. Remember to check for the existence of the file before using it.'
43
47
  value: ${{ steps.alkiln_outputs.outputs.PATH_TO_REPORT_FILE }}
48
+ PATH_TO_REPORT_LOG_FILE:
49
+ description: 'An empty string ("") or the path to report_log.txt. Remember to check for the existence of the file before using it.'
50
+ value: ${{ steps.alkiln_outputs.outputs.PATH_TO_REPORT_LOG_FILE }}
44
51
  PATH_TO_UNEXPECTED_RESULTS_FILE:
45
52
  description: 'An empty string ("") or the path to unexpected_results.txt. Remember to check for the existence of the file before using it.'
46
53
  value: ${{ steps.alkiln_outputs.outputs.PATH_TO_UNEXPECTED_RESULTS_FILE }}
@@ -65,11 +72,23 @@ runs:
65
72
  MAX_SECONDS_FOR_SETUP: ${{ inputs.MAX_SECONDS_FOR_SETUP }}
66
73
  SERVER_RELOAD_TIMEOUT_SECONDS: ${{ inputs.SERVER_RELOAD_TIMEOUT_SECONDS }}
67
74
  DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
75
+ MAX_RANDOM_TESTS_PER_SCENARIO: ${{ inputs.MAX_RANDOM_TESTS_PER_SCENARIO }}
68
76
  shell: bash
69
77
  run: |
70
- # šŸ’” ALK0023 INFO: Set environment variables
78
+ log="šŸ’” ALK0023 INFO: Set environment variables and create artifacts folder"
79
+
71
80
  # Human-readable date/time: https://www.shell-tips.com/linux/how-to-format-date-and-time-in-linux-macos-and-bash/#how-to-format-a-date-in-bash
72
- echo "ARTIFACT_NAME=alkiln-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
81
+ timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
82
+ artifact_folder="alkiln-${timestamp}UTC"
83
+ debug_path="${artifact_folder}/debug_log.txt"
84
+ mkdir -p "$artifact_folder"
85
+ echo "$log" >> "$debug_path"
86
+
87
+ # Action-specific vars
88
+ echo "ARTIFACT_FOLDER=$artifact_folder" >> $GITHUB_ENV
89
+ echo "DEBUG_PATH=$debug_path" >> $GITHUB_ENV
90
+
91
+ # Required for all tests
73
92
  echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
74
93
  echo "BRANCH_PATH=$BRANCH_PATH" >> $GITHUB_ENV
75
94
  # Workflow inputs
@@ -77,6 +96,7 @@ runs:
77
96
  echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DOCASSEMBLE_DEVELOPER_API_KEY" >> $GITHUB_ENV
78
97
  echo "ALKILN_VERSION=$ALKILN_VERSION" >> $GITHUB_ENV
79
98
  echo "MAX_SECONDS_FOR_SETUP=$MAX_SECONDS_FOR_SETUP" >> $GITHUB_ENV
99
+ echo "MAX_RANDOM_TESTS_PER_SCENARIO=$MAX_RANDOM_TESTS_PER_SCENARIO" >> $GITHUB_ENV
80
100
  echo "SERVER_RELOAD_TIMEOUT_SECONDS=$SERVER_RELOAD_TIMEOUT_SECONDS" >> $GITHUB_ENV
81
101
  echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
82
102
  # Hard-coded internal ALKiln vars
@@ -84,21 +104,36 @@ runs:
84
104
  - name: "šŸ’” ALK0024 INFO: Confirm environment variables"
85
105
  shell: bash
86
106
  run: |
87
- # šŸ’” ALK0024 INFO: Confirm environment variables
88
- echo -e "\nALKiln version is $ALKILN_VERSION\nRepo is $REPO_URL\nBranch ref is $BRANCH_PATH\nMAX_SECONDS_FOR_SETUP is $MAX_SECONDS_FOR_SETUP\nSERVER_RELOAD_TIMEOUT_SECONDS is $SERVER_RELOAD_TIMEOUT_SECONDS\n"
107
+ log="šŸ’” ALK0024 INFO: Confirm environment variables"
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'
110
+ echo -e "$vars_log" >> "${{ env.DEBUG_PATH }}" && echo -e "$vars_log"
89
111
 
90
- # Install
91
- - name: "šŸ’” ALK0025 INFO: Install node packages"
112
+ # Install ALKiln into GitHub workflow
113
+ - name: "šŸ’” ALK0025 INFO: Set up node"
92
114
  uses: actions/setup-node@v4
93
115
  with:
94
116
  node-version: "18"
95
117
  - name: "šŸ’” ALK0026 INFO: Install ALKiln directly from npm"
96
118
  shell: bash
97
119
  run: |
98
- # šŸ’” ALK0026 INFO: Install ALKiln directly from npm
120
+ log="šŸ’” ALK0026 INFO: Install ALKiln directly from npm"
121
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
99
122
  npm install -g "@suffolklitlab/alkiln@$ALKILN_VERSION"
100
123
 
101
- # Install on playground
124
+ # Files prep
125
+
126
+ - shell: bash
127
+ env:
128
+ ARTIFACT_FOLDER: ${{ env.ARTIFACT_FOLDER }}
129
+ run: |
130
+ log="šŸ’” ALK0273 INFO: Prepare repository test files"
131
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
132
+ alkiln-artifacts --path="${{ env.ARTIFACT_FOLDER }}"
133
+ alkiln-validate
134
+ alkiln-generate
135
+
136
+ # Install package on playground
102
137
 
103
138
  # Don't rely on the environment's version of python
104
139
  - uses: actions/setup-python@v5
@@ -109,26 +144,32 @@ runs:
109
144
  if: ${{ inputs.INSTALL_METHOD == 'playground' }}
110
145
  shell: bash
111
146
  run: |
112
- # šŸ’” ALK0027 INFO: Create a Project and install the package from GitHub
147
+ log="šŸ’” ALK0027 INFO: Create a Project and install the package from GitHub"
148
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
113
149
  pip install "docassemblecli==$DOCASSEMBLECLI_VERSION"
114
150
  alkiln-setup
115
- - name: "šŸ˜ž ALK0028 ERROR: Unable to create a Project"
151
+ - name: "šŸ¤• ALK0028 ERROR: Unable to create a Project"
116
152
  if: ${{ inputs.INSTALL_METHOD == 'playground' && failure() }}
117
153
  shell: bash
118
154
  run: |
119
- # šŸ˜ž ALK0028 ERROR: Unable to create a Project
120
- echo -e "\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"
155
+ # "šŸ¤• ALK0028 ERROR: Unable to create a Project"
156
+ 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
+ echo -e "$long_log" >> "${{ env.DEBUG_PATH }}" && echo -e "$long_log"
121
158
 
122
159
  # Server installations - find folders and save session vars
123
160
  - name: "šŸ’” ALK0029 INFO: Install the GitHub package onto the server"
124
161
  if: ${{ inputs.INSTALL_METHOD == 'server' }}
125
162
  shell: bash
126
- run: alkiln-server-install
127
- - name: "šŸ˜ž ALK0030 ERROR: Unable to install the package"
163
+ run: |
164
+ log="šŸ’” ALK0029 INFO: Install the GitHub package onto the server"
165
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
166
+ alkiln-server-install
167
+ - name: "šŸ¤• ALK0030 ERROR: Unable to install the package"
128
168
  if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
129
169
  shell: bash
130
170
  run: |
131
- echo -e "\n\n====\nšŸ˜ž ALK0030 ERROR: Unable to install the package on the temporary GitHub docassemble server. Check the steps above this line.\n\n"
171
+ log="\n\n―――\nšŸ¤• ALK0030 ERROR: Unable to install the package on the temporary GitHub docassemble server. Check the steps above this line.\n\n"
172
+ echo -e "$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
132
173
 
133
174
  # run tests
134
175
  - name: "šŸ’” ALK0031 INFO: Run tests"
@@ -136,20 +177,26 @@ runs:
136
177
  env:
137
178
  ALKILN_TAG_EXPRESSION: ${{ inputs.ALKILN_TAG_EXPRESSION || github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
138
179
  shell: bash
139
- run: alkiln-run "$ALKILN_TAG_EXPRESSION"
180
+ run: |
181
+ log="šŸ’” ALK0031 INFO: Run tests"
182
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
183
+ alkiln-run "$ALKILN_TAG_EXPRESSION"
140
184
 
141
185
  # on playground, delete project
142
186
  - name: "šŸ’” ALK0032 INFO: Delete the Project from the Playground"
143
187
  if: ${{ always() && inputs.INSTALL_METHOD == 'playground' }}
144
- run: alkiln-takedown
145
188
  shell: bash
189
+ run: |
190
+ log="šŸ’” ALK0032 INFO: Delete the Project from the Playground"
191
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
192
+ alkiln-takedown
146
193
 
147
194
  # Upload artifacts that subscribers can download on the Actions summary page
148
195
  - name: "šŸ’” ALK0033 INFO: Upload artifacts folder"
149
196
  if: ${{ always() }}
150
197
  uses: actions/upload-artifact@v4
151
198
  with:
152
- name: ${{ env.ARTIFACT_NAME }}
199
+ name: ${{ env.ARTIFACT_FOLDER }}
153
200
  path: ./alkiln-*
154
201
 
155
202
  # Download artifacts folder internally to create action output
@@ -157,45 +204,56 @@ runs:
157
204
  if: ${{ always() }}
158
205
  uses: actions/download-artifact@v4
159
206
  with:
160
- name: ${{ env.ARTIFACT_NAME }}
207
+ name: ${{ env.ARTIFACT_FOLDER }}
161
208
 
162
209
  - name: "šŸ’” ALK0184 INFO: Prepare ALKiln output file paths"
163
210
  if: ${{ always() }}
164
211
  id: alkiln_outputs
165
212
  shell: bash
166
213
  run: |
167
- # šŸ’” ALK0184 INFO: Prepare ALKiln output file paths
214
+ log="šŸ’” ALK0184 INFO: Prepare ALKiln output file paths"
215
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo "$log"
168
216
 
169
217
  FOLDER=$(ls -d */ | grep -E '^alkiln-*' || true)
170
218
 
171
- echo "Test results artifacts folder is $FOLDER"
219
+ log_folder="Test results artifacts folder is $FOLDER"
220
+ echo -e "\n$log_folder" >> "${{ env.DEBUG_PATH }}" && echo "$log_folder"
172
221
 
173
222
  if [[ "$FOLDER" = "" ]]; then
174
- echo "Artifacts folder is missing. The path is an empty string: '$FOLDER'"
223
+ log_missing="Artifacts folder is missing. The path is an empty string: '$FOLDER'"
224
+ echo -e "\n$log_missing" >> "${{ env.DEBUG_PATH }}" && echo "$log_missing"
175
225
 
176
226
  else
177
227
  REPORT_PATH="${FOLDER}report.txt"
228
+ REPORT_LOG_PATH="${FOLDER}report_log.txt"
178
229
  UNEXPECTED_RESULTS_PATH="${FOLDER}unexpected_results.txt"
179
230
  DEBUG_LOG_PATH="${FOLDER}debug_log.txt"
180
231
 
181
232
  if [ -f "$REPORT_PATH" ]; then
182
- echo "$REPORT_PATH exists"
233
+ echo -e "\n$REPORT_PATH exists" >> "${{ env.DEBUG_PATH }}" && echo "$REPORT_PATH exists"
183
234
  else
184
- echo "$REPORT_PATH is missing"
235
+ echo -e "\n$REPORT_PATH is missing" >> "${{ env.DEBUG_PATH }}" && echo "$REPORT_PATH is missing"
185
236
  REPORT_PATH=""
186
237
  fi
187
238
 
239
+ if [ -f "$REPORT_LOG_PATH" ]; then
240
+ echo -e "\n$REPORT_LOG_PATH exists" >> "${{ env.DEBUG_PATH }}" && echo "$REPORT_LOG_PATH exists"
241
+ else
242
+ echo -e "\n$REPORT_LOG_PATH is missing" >> "${{ env.DEBUG_PATH }}" && echo "$REPORT_LOG_PATH is missing"
243
+ REPORT_LOG_PATH=""
244
+ fi
245
+
188
246
  if [ -f "$UNEXPECTED_RESULTS_PATH" ]; then
189
- echo "$UNEXPECTED_RESULTS_PATH exists"
247
+ echo -e "\n$UNEXPECTED_RESULTS_PATH exists" >> "${{ env.DEBUG_PATH }}" && echo "$UNEXPECTED_RESULTS_PATH exists"
190
248
  else
191
- echo "$UNEXPECTED_RESULTS_PATH is missing"
249
+ echo -e "\n$UNEXPECTED_RESULTS_PATH is missing" >> "${{ env.DEBUG_PATH }}" && echo "$UNEXPECTED_RESULTS_PATH is missing"
192
250
  UNEXPECTED_RESULTS_PATH=""
193
251
  fi
194
252
 
195
253
  if [ -f "$DEBUG_LOG_PATH" ]; then
196
- echo "$DEBUG_LOG_PATH exists"
254
+ echo -e "\n$DEBUG_LOG_PATH exists" >> "${{ env.DEBUG_PATH }}" && echo "$DEBUG_LOG_PATH exists"
197
255
  else
198
- echo "$DEBUG_LOG_PATH is missing"
256
+ echo -e "\n$DEBUG_LOG_PATH is missing" >> "${{ env.DEBUG_PATH }}" && echo "$DEBUG_LOG_PATH is missing"
199
257
  DEBUG_LOG_PATH=""
200
258
  fi
201
259
 
@@ -203,6 +261,7 @@ runs:
203
261
 
204
262
  echo "PATH_TO_ARTIFACTS=$FOLDER" >> "$GITHUB_OUTPUT"
205
263
  echo "PATH_TO_REPORT_FILE=$REPORT_PATH" >> "$GITHUB_OUTPUT"
264
+ echo "PATH_TO_REPORT_LOG_FILE=$REPORT_LOG_PATH" >> "$GITHUB_OUTPUT"
206
265
  echo "PATH_TO_UNEXPECTED_RESULTS_FILE=$UNEXPECTED_RESULTS_PATH" >> "$GITHUB_OUTPUT"
207
266
  echo "PATH_TO_DEBUG_LOG_FILE=$DEBUG_LOG_PATH" >> "$GITHUB_OUTPUT"
208
267
 
@@ -212,4 +271,5 @@ runs:
212
271
  - shell: bash
213
272
  if: ${{ always() }}
214
273
  run: |
215
- echo "šŸ’” ALK0034 INFO: ALkiln finished running tests"
274
+ log="šŸ’” ALK0034 INFO: ALkiln finished running tests. See above for more details."
275
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo "$log"
@@ -47,12 +47,41 @@ runs:
47
47
  # Place the root directory in this branch
48
48
  - uses: actions/checkout@v4
49
49
 
50
+ - shell: bash
51
+ run: |
52
+ log="šŸ’” ALK0018 INFO: Get path names with date and time"
53
+ timestamp="$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)"
54
+ debug_dir="/tmp"
55
+ debug_path="$debug_dir/alkiln_docker_logs-${timestamp}UTC.txt"
56
+ artifact_folder="alkiln_github_server-${timestamp}UTC"
57
+
58
+ mkdir -p "$debug_dir"
59
+ mkdir -p "$artifact_folder"
60
+ echo -e "$log" >> "$debug_path"
61
+
62
+ echo "DEBUG_PATH=$debug_path" >> $GITHUB_ENV
63
+ echo "GITHUB_SERVER_ARTIFACT_NAME=$artifact_folder" >> $GITHUB_ENV
64
+
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
+
50
77
  - shell: bash
51
78
  env:
52
79
  MAX_SECONDS_FOR_DOCKER: ${{ inputs.MAX_SECONDS_FOR_DOCKER }}
53
80
  DOCASSEMBLECLI_VERSION: ${{ inputs.DOCASSEMBLECLI_VERSION }}
54
81
  run: |
55
- # šŸ’”ALK0001 INFO: Set environment variables
82
+ log="šŸ’” ALK0001 INFO: Set environment variables"
83
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
84
+
56
85
  echo "MAX_SECONDS_FOR_DOCKER=$MAX_SECONDS_FOR_DOCKER" >> $GITHUB_ENV
57
86
  echo "DOCASSEMBLECLI_VERSION=$DOCASSEMBLECLI_VERSION" >> $GITHUB_ENV
58
87
  echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
@@ -63,7 +92,8 @@ runs:
63
92
  id: api_key_output_step
64
93
  shell: bash
65
94
  run: |
66
- # šŸ’” ALK0002 INFO: Create GitHub step output variables
95
+ log="šŸ’” ALK0002 INFO: Create GitHub step output variables"
96
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
67
97
  echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DA_ADMIN_API_KEY" >> "$GITHUB_OUTPUT"
68
98
  echo "DA_ADMIN_EMAIL=$DA_ADMIN_EMAIL" >> "$GITHUB_OUTPUT"
69
99
  echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
@@ -73,16 +103,20 @@ runs:
73
103
  CONFIG: ${{ inputs.CONFIG_CONTENTS }}
74
104
  shell: bash
75
105
  run: |
76
- # šŸ’” ALK0003 INFO: Get config
106
+ log="šŸ’” ALK0003 INFO: Get config"
107
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
108
+
77
109
  mkdir /tmp/config
78
110
  # Worth making this silent by defining a variable with > /dev/null...?
79
111
  if [ -n "$CONFIG" ]
80
112
  then
81
- echo "šŸ’” ALK0004 INFO: The developer did provide a custom docassemble config file as an input into this action."
113
+ log2="šŸ’” ALK0004 INFO: The developer did provide a custom docassemble config file as an input into this action."
114
+ echo -e "\n$log2" >> "${{ env.DEBUG_PATH }}" echo "$log2"
82
115
  echo "$CONFIG" > /tmp/config/myconfig.yml
83
116
  echo "CONFIG_ARGS=--env DA_CONFIG=/tmp/config/myconfig.yml --volume /tmp/config:/tmp/config " >> $GITHUB_ENV
84
117
  else
85
- echo "šŸ’” ALK0005 INFO: The developer did NOT provide a custom docassemble config file as an input into this action. Docassemble will use its default config."
118
+ 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.DEBUG_PATH }}" echo "$log3"
86
120
  echo "CONFIG_ARGS=" >> $GITHUB_ENV
87
121
  fi
88
122
 
@@ -97,11 +131,14 @@ runs:
97
131
  SHOW_DOCKER_OUTPUT: ${{ inputs.SHOW_DOCKER_OUTPUT }}
98
132
  shell: bash
99
133
  run: |
100
- # šŸ’” ALK0006 INFO: Determine docker logs visibility
134
+ log="šŸ’” ALK0006 INFO: Determine docker logs visibility"
135
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
101
136
  if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
102
137
  echo "OUTPUT_DOCKER=$SHOW_DOCKER_OUTPUT" >> $GITHUB_ENV
138
+ echo -e "\n$SHOW_DOCKER_OUTPUT" >> "${{ env.DEBUG_PATH }}"
103
139
  else
104
140
  echo "OUTPUT_DOCKER=false" >> $GITHUB_ENV
141
+ echo -e "\nfalse" >> "${{ env.DEBUG_PATH }}"
105
142
  fi
106
143
 
107
144
  # Messages about output
@@ -110,13 +147,15 @@ runs:
110
147
  shell: bash
111
148
  run: |
112
149
  # šŸ’” ALK0007 INFO: ALKiln will now hide docker output
113
- echo -e '===\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==='
150
+ 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.DEBUG_PATH }}" && echo -e "$log"
114
152
  - name: "šŸ’” ALK0008 INFO: ALKiln will show docker output"
115
153
  if: ${{ env.OUTPUT_DOCKER == 'true' }}
116
154
  shell: bash
117
155
  run: |
118
156
  # šŸ’” ALK0008 INFO: ALKiln will show docker output
119
- echo -e '===\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==='
157
+ 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.DEBUG_PATH }}" && echo -e "$log"
120
159
 
121
160
  # TODO: Reduce these to 1 block by putting ` > /dev/null 2>&1` into an env var
122
161
  # No docker output
@@ -126,7 +165,8 @@ runs:
126
165
  CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
127
166
  shell: bash
128
167
  run: |
129
- # šŸ’” ALK0009 INFO: Download and start docker silently
168
+ log="šŸ’” ALK0009 INFO: Download and start docker silently"
169
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
130
170
  docker pull jhpyle/docassemble > /dev/null 2>&1
131
171
  docker run --name docassemble_container \
132
172
  --env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
@@ -142,7 +182,8 @@ runs:
142
182
  CONFIG_ARGS: ${{ env.CONFIG_ARGS }}
143
183
  shell: bash
144
184
  run: |
145
- # šŸ’” ALK0010 INFO: Download and start docker
185
+ log="šŸ’” ALK0010 INFO: Download and start docker"
186
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
146
187
  docker pull jhpyle/docassemble
147
188
  docker run --name docassemble_container \
148
189
  --env DA_ADMIN_EMAIL="$DA_ADMIN_EMAIL" \
@@ -159,12 +200,14 @@ runs:
159
200
  shell: bash
160
201
  run: |
161
202
  # šŸ’” ALK0011 INFO: The following messages are not docker output
162
- echo "šŸ’” ALK0011 INFO: The following messages are not docker output, just ALKiln waiting for the server to start"
203
+ log="šŸ’” ALK0011 INFO: The following messages are NOT docker output, just ALKiln waiting for the server to start"
204
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
163
205
 
164
206
  - name: "šŸ’” ALK0012 INFO: Waiting for server to start"
165
207
  shell: bash
166
208
  run: |
167
- # šŸ’” ALK0012 INFO: Waiting for server to start
209
+ log="šŸ’” ALK0012 INFO: Waiting for server to start"
210
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
168
211
 
169
212
  # Reset the SECONDS variable
170
213
  SECONDS=0
@@ -173,23 +216,28 @@ runs:
173
216
 
174
217
  response="start"
175
218
  while [[ $response != *"200"* ]]; do
176
- echo "šŸ’” ALK0013 INFO: Time elapsed: $SECONDS seconds"
219
+ log2="šŸ’” ALK0013 INFO: Time elapsed: $SECONDS seconds"
220
+ echo -e "\n$log2" >> "${{ env.DEBUG_PATH }}" && echo -e "$log2"
177
221
 
178
222
  # Check if max seconds till loading has passed
179
223
  if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
180
- echo "šŸ¤• 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."
224
+ 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.DEBUG_PATH }}" && echo -e "$log3"
181
226
  exit 1
182
227
  fi
183
228
 
184
229
  # Set the variable to a new string value in each iteration
185
230
  response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
186
- echo "šŸ’” ALK0015 INFO: Response is $response"
231
+ log4="šŸ’” ALK0015 INFO: Response is $response"
232
+ echo -e "\n$log4" >> "${{ env.DEBUG_PATH }}" && echo -e "$log4"
187
233
 
188
234
  # Check if the string includes the desired text
189
235
  if [[ $response == *"200"* ]]; then
190
- echo "🌈 ALK0016 SUCCESS: Success! The docker container is ready!"
236
+ log5="šŸ’” ALK0016 SUCCESS: Success! The docker container is ready!"
237
+ echo -e "\n$log5" >> "${{ env.DEBUG_PATH }}" && echo -e "$log5"
191
238
  else
192
- echo "šŸ’” ALK0017 INFO: The docker container is not ready yet. Will check again in 30 seconds."
239
+ log6="šŸ’” ALK0017 INFO: The docker container is not ready yet. Will check again in 30 seconds."
240
+ echo -e "\n$log6" >> "${{ env.DEBUG_PATH }}" && echo -e "$log6"
193
241
  sleep 30
194
242
  fi
195
243
 
@@ -219,32 +267,28 @@ runs:
219
267
 
220
268
  # Upload artifacts that devs can download on the Actions summary page
221
269
  # Only if the developer wants to get that info, though
222
- - name: "šŸ’” ALK0018 INFO: Get path names with date and time"
223
- if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
224
- shell: bash
225
- run: |
226
- # šŸ’” ALK0018 INFO: Get path names with date and time
227
- echo "GITHUB_SERVER_LOG_FILE_NAME=/tmp/alkiln_docker_logs-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC.txt" >> $GITHUB_ENV
228
- echo "GITHUB_SERVER_ARTIFACT_NAME=alkiln_github_server-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
229
270
  - name: "šŸ’” ALK0019 INFO: Create docker artifact data"
230
271
  if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
231
272
  shell: bash
232
273
  run: |
233
- # šŸ’” ALK0019 INFO: Create docker artifact data
234
- echo "$(docker output docassemble_container)" > "${{ env.GITHUB_SERVER_LOG_FILE_NAME }}"
274
+ log="šŸ’” ALK0019 INFO: Create docker artifact data"
275
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}"
276
+ echo "$(docker output docassemble_container)" >> "${{ env.DEBUG_PATH }}"
235
277
  - name: "šŸ’” ALK0020 INFO: Upload artifacts folder"
236
278
  if: ${{ always() && env.OUTPUT_DOCKER == 'true' }}
237
279
  uses: actions/upload-artifact@v4
238
280
  with:
239
281
  name: ${{ env.GITHUB_SERVER_ARTIFACT_NAME }}
240
- path: ${{ env.GITHUB_SERVER_LOG_FILE_NAME }}
282
+ path: ${{ env.DEBUG_PATH }}
241
283
 
242
284
  - shell: bash
243
285
  if: ${{ success() }}
244
286
  run: |
245
- echo "🌈 ALK0021 SUCCESS: ALKiln created the docker container and started the server!"
287
+ log="šŸ’” ALK0021 SUCCESS: ALKiln created the docker container and started the server!"
288
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"
246
289
 
247
290
  - shell: bash
248
291
  if: ${{ failure() }}
249
292
  run: |
250
- echo "šŸ¤• ALK0022 ERROR: Something went wrong. See above for more details."
293
+ log="šŸ¤• ALK0022 ERROR: Something went wrong. See above for more details."
294
+ echo -e "\n$log" >> "${{ env.DEBUG_PATH }}" && echo -e "$log"