@suffolklitlab/alkiln 5.0.2-feat-github-server-11 → 5.0.2-feat-github-server-12

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.
@@ -16,7 +16,7 @@ on:
16
16
  type: boolean
17
17
  description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
18
18
  required: false
19
- default: true
19
+ default: false
20
20
  # TODO: alkiln_version:
21
21
 
22
22
  jobs:
@@ -28,16 +28,18 @@ jobs:
28
28
  node-version: [18.x]
29
29
 
30
30
  env:
31
- # USER1_EMAIL: admin@example.com
32
- # USER1_PASSWORD: "@12lsdnejewng"
33
31
  # How would a dev make another user/password if they wanted to?
34
32
  SECRET_VAR1: secret-var1-value
35
33
  SECRET_VAR2: secret-var2-value
36
34
  SECRET_FOR_MISSING_FIELD: secret for missing field
37
- _ALKILN_DANGEROUS_DEBUG: true
35
+ #_ALKILN_DANGEROUS_DEBUG: true
38
36
 
39
37
  steps:
38
+ # Place the root directory in this branch
40
39
  - uses: actions/checkout@v3
40
+
41
+ # Debugging. Maybe add a long sleep after whatever it is we want to check
42
+ # to give us time to explore.
41
43
  - name: Setup tmate session
42
44
  if: ${{ inputs.enable_tmate }}
43
45
  uses: mxschmitt/action-tmate@v3
@@ -51,15 +53,22 @@ jobs:
51
53
  CONFIG_CONTENTS: "${{ secrets.CONFIG_CONTENTS }}"
52
54
  - run: echo "Finished starting the GitHub server"
53
55
 
56
+ # Debugging on failure
57
+ # Trying to catch that intermittent bug mentioned in ./github_server/action.yml
58
+ - name: Docker failure tmate session
59
+ if: ${{ failure() }}
60
+ uses: mxschmitt/action-tmate@v3
61
+
54
62
  - name: Set more env vars
55
63
  run: |
56
64
  echo "USER1_EMAIL=${{ steps.github_server.outputs.DA_ADMIN_EMAIL }}" >> $GITHUB_ENV
57
65
  echo "USER1_PASSWORD=${{ steps.github_server.outputs.DA_ADMIN_PASSWORD }}" >> $GITHUB_ENV
58
- - name: Work with docker
59
- run: |
60
- # Authors can use this to do more with the docker container
61
- container_name=$(docker ps --format '{{.Names}}' | head -n 1)
62
- echo "container_name is $container_name"
66
+ #- name: Work with docker
67
+ # run: |
68
+ # # Authors can use this to do more with the docker container.
69
+ # # There may be a better way. Would take research. A docker action?
70
+ # container_name=$(docker ps --format '{{.Names}}' | head -n 1)
71
+ # echo "container_name is $container_name"
63
72
 
64
73
  - name: "Run ALKiln tests"
65
74
  if: ${{ success() }}
@@ -69,6 +78,6 @@ jobs:
69
78
  DOCASSEMBLE_DEVELOPER_API_KEY: "${{ steps.github_server.outputs.DOCASSEMBLE_DEVELOPER_API_KEY }}"
70
79
  INSTALL_METHOD: "server"
71
80
  # TODO: See what happens if this is an empty string
72
- ALKILN_VERSION: "5.0.2-feat-github-server-11"
81
+ ALKILN_VERSION: "5.0.2-feat-github-server-12"
73
82
  - run: echo "Finished running ALKiln tests"
74
83
 
package/action.yml CHANGED
@@ -24,7 +24,7 @@ inputs:
24
24
  required: false
25
25
  # no default to let the custom Scenario timeouts create the reload timeout
26
26
  # INSTALL_LOCATION? Will that get confused with the location passed into the command line?
27
- # Maybe it could be "playground", "server", or a custom path and we could handle all those.
27
+ # Maybe `INSTALL_LOCATION` could be "playground", "server", or a custom path and we could handle all those.
28
28
  INSTALL_METHOD:
29
29
  description: "Default is 'playground'. Other option: 'server'. How to install the package onto the server."
30
30
  required: false
@@ -81,17 +81,11 @@ runs:
81
81
  if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
82
82
  shell: bash
83
83
 
84
- ############
85
- ##### !!! WARNING: RESTORE CODE FOR TAGS
86
- ############
87
84
  # run tests
88
85
  - name: "ALKiln: Run tests"
89
86
  if: ${{ success() }}
90
- # run: alkiln-run @e6 or @al1
91
- run: alkiln-run @e6
87
+ run: alkiln-run ${{ github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
92
88
  shell: bash
93
-
94
- # run: alkiln-run ${{ github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
95
89
 
96
90
  # on playground, delete project
97
91
  - name: "ALKiln: Try to delete the project from the playground of the docassemble test account."
@@ -108,7 +102,7 @@ runs:
108
102
  path: ./alkiln-*
109
103
 
110
104
  # ##################################
111
- # # A developer's workflow should look similar to the below
105
+ # # A developer's workflow should look similar to the below.
112
106
  # # In place of `uses: suffolkLITLab/ALKiln@v5`, they
113
107
  # # might use another version.
114
108
  #
@@ -12,6 +12,16 @@ description: "Download and start up a temporary docassemble server on GitHub's s
12
12
  # 120 sec with exit code 56:
13
13
  # https://github.com/SuffolkLITLab/ALKiln/actions/runs/5914963614/job/16040773624#step:4:206
14
14
 
15
+ # If we want to control the version of the docassemble image, we'd have
16
+ # to make our own image:
17
+ # You can build your own image by doing git clone jhpyle/docassemble and then
18
+ # using git checkout to select a particular version, and then using docker build
19
+ # to build an image. https://docassemble.org/docs/docker.html#downgrading
20
+ # If we just want to use an older version of da (as long as it works with
21
+ # the latest image):
22
+ # If you have an existing container you can use dainstall from the command
23
+ # line to install docassemble.webapp==1.4.68
24
+
15
25
  inputs:
16
26
  CONFIG_CONTENTS:
17
27
  description: "The contents of the config file of the docassemble server"
@@ -37,6 +47,8 @@ outputs:
37
47
  runs:
38
48
  using: "composite"
39
49
  steps:
50
+ - uses: actions/checkout@v3
51
+
40
52
  - name: "ALKiln github_server: Set environment variables"
41
53
  run: |
42
54
  echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
@@ -50,10 +62,11 @@ runs:
50
62
  shell: bash
51
63
  - id: api_key_output_step
52
64
  run: |
53
- echo "::set-output name=DOCASSEMBLE_DEVELOPER_API_KEY::$DA_ADMIN_API_KEY"
54
- echo "::set-output name=DA_ADMIN_EMAIL::$DA_ADMIN_EMAIL"
55
- echo "::set-output name=DA_ADMIN_PASSWORD::$DA_ADMIN_PASSWORD"
65
+ echo "DOCASSEMBLE_DEVELOPER_API_KEY=$DA_ADMIN_API_KEY" >> "$GITHUB_OUTPUT"
66
+ echo "DA_ADMIN_EMAIL=$DA_ADMIN_EMAIL" >> "$GITHUB_OUTPUT"
67
+ echo "DA_ADMIN_PASSWORD=$DA_ADMIN_PASSWORD" >> "$GITHUB_OUTPUT"
56
68
  shell: bash
69
+
57
70
  - name: "ALKiln github_server: Download and start docker"
58
71
  run: |
59
72
  mkdir /tmp/config
@@ -70,26 +83,26 @@ runs:
70
83
  # Wait 1 minute before pinging the server constantly
71
84
  sleep 60
72
85
 
73
- # Use a variable instead of checking $result so we can control to avoid race
86
+ # Use a variable instead of checking $response so we can control to avoid race
74
87
  # conditions from preventing the success log message.
75
88
  ready="false"
76
89
 
77
90
  while [[ $ready == "false" ]]; do
78
91
  echo "Time ellapsed: $SECONDS seconds"
79
92
 
80
- # Get input for max number of seconds to wait
81
- # ${{ inputs.MAX_SECONDS_FOR_DOCKER }} as a number? Bash doesn't have types, just strings
82
93
  # Check if max seconds till loading has passed
83
94
  if [[ $SECONDS -ge $MAX_SECONDS_FOR_DOCKER ]]; then
84
95
  echo "ALKiln GitHub Server 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."
96
+ # Exit with failure, or allow this to keep going?
85
97
  break
86
98
  fi
87
99
 
88
100
  # Set the variable to a new string value in each iteration
89
- result=$(curl -s localhost)
101
+ response=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:80/health_check?ready=1)
102
+ echo "response is $response"
90
103
 
91
104
  # Check if the string includes the desired text
92
- if [[ ! $result == *"Docassemble is starting"* ]]; then
105
+ if [[ $response == *"200"* ]]; then
93
106
  echo "Success! The docker container is ready!"
94
107
  ready="true"
95
108
  else
@@ -100,29 +113,14 @@ runs:
100
113
  done
101
114
  shell: bash
102
115
 
103
- - name: "ALKiln github_server: Install the package"
104
- id: container_output_step
105
- run: |
106
- echo "CLONE_URL is $CLONE_URL"
107
- git clone $CLONE_URL
108
-
109
- # Split the full repository name by '/' and get the last element (repo name)
110
- IFS='/' read -ra repo_parts <<< "$OWNER_AND_REPO_NAME"
111
- repo_name=${repo_parts[-1]}
112
- echo "repo_name is $repo_name"
113
- cd $repo_name
114
-
115
- echo "BRANCH_REF is $BRANCH_REF"
116
- ref_name=$BRANCH_REF
117
- branch_name="${ref_name#refs/heads/}"
118
- echo "branch name is $branch_name"
119
- git checkout -b $branch_name
120
- git fetch origin $branch_name
121
- git reset --hard origin/$branch_name
122
-
123
- cd ..
124
- pip install docassemblecli
125
- dainstall $repo_name --apiurl http://localhost --apikey $DA_ADMIN_API_KEY
116
+ # Don't rely on the environment's version of python
117
+ - uses: actions/setup-python@v4
118
+ with:
119
+ python-version: '3.10'
120
+ - run: pip install docassemblecli
121
+ shell: bash
122
+ # Install the current directory into docassemble
123
+ - run: dainstall . --apiurl http://localhost --apikey $DA_ADMIN_API_KEY
126
124
  shell: bash
127
125
 
128
126
  # Upload artifacts that subscribers can download on the Actions summary page
@@ -136,6 +134,7 @@ runs:
136
134
 
137
135
  # Should this date/time be created at the start of this action?
138
136
  - name: "ALKiln github_server: Get folder name with date and time"
137
+ if: ${{ always() }}
139
138
  run: |
140
139
  echo "GITHUB_SERVER_ARTIFACT_NAME=alkiln-github-server-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
141
140
  shell: bash
package/lib/scope.js CHANGED
@@ -759,8 +759,6 @@ module.exports = {
759
759
 
760
760
  if ( !scope.page ) { scope.page = await scope.browser.newPage(); }
761
761
 
762
- console.log(`interview_url:`, interview_url);
763
-
764
762
  // TODO: implement and use scope.handle_possible_timeout()
765
763
  try {
766
764
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.0.2-feat-github-server-11",
3
+ "version": "5.0.2-feat-github-server-12",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {