@suffolklitlab/alkiln 5.0.2-feat-github-server-7 → 5.0.2-feat-github-server-8

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.
@@ -49,6 +49,10 @@ jobs:
49
49
  CONFIG_CONTENTS: "${{ secrets.CONFIG_CONTENTS }}"
50
50
  - run: echo "Finished starting the GitHub server"
51
51
 
52
+ ## Temp
53
+ #- name: Setup tmate session
54
+ # uses: mxschmitt/action-tmate@v3
55
+
52
56
  - name: "Run ALKiln tests"
53
57
  if: ${{ success() }}
54
58
  uses: ./
@@ -56,6 +60,6 @@ jobs:
56
60
  SERVER_URL: "${{ steps.github_server.outputs.SERVER_URL }}"
57
61
  DOCASSEMBLE_DEVELOPER_API_KEY: "${{ steps.github_server.outputs.DOCASSEMBLE_DEVELOPER_API_KEY }}"
58
62
  INSTALL_METHOD: "server"
59
- ALKILN_VERSION: "5.0.2-feat-github-server-7"
63
+ ALKILN_VERSION: "5.0.2-feat-github-server-8"
60
64
  - run: echo "Finished running ALKiln tests"
61
65
 
package/action.yml CHANGED
@@ -53,7 +53,7 @@ runs:
53
53
  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"
54
54
  shell: bash
55
55
 
56
- # Install node
56
+ # Install
57
57
  - name: "ALKiln: Install node packages"
58
58
  uses: actions/setup-node@v3
59
59
  with:
@@ -81,33 +81,34 @@ runs:
81
81
  if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
82
82
  shell: bash
83
83
 
84
- # debugging
85
- - name: Setup tmate session
86
- uses: mxschmitt/action-tmate@v3
84
+ ## debugging
85
+ #- name: Setup tmate session
86
+ # uses: mxschmitt/action-tmate@v3
87
87
 
88
88
  ############
89
89
  ##### !!! WARNING: RESTORE CODE FOR TAGS
90
90
  ############
91
- ## run tests
92
- #- name: "ALKiln: Run tests"
93
- # if: ${{ success() }}
94
- # run: alkiln-run @e6 or @al1
95
- # #run: alkiln-run ${{ github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
96
- # shell: bash
97
- #
98
- ## on playground, delete project
99
- #- name: "ALKiln: Try to delete the project from the playground of the docassemble test account."
100
- # if: ${{ inputs.INSTALL_METHOD == 'playground' }}
101
- # run: alkiln-takedown
102
- # shell: bash
103
- #
104
- ## Upload artifacts that subscribers can download on the Actions summary page
105
- #- name: "ALKiln: Upload artifacts folder"
106
- # if: ${{ always() }}
107
- # uses: actions/upload-artifact@v3
108
- # with:
109
- # name: ${{ env.ARTIFACT_NAME }}
110
- # path: ./alkiln-*
91
+ # run tests
92
+ - name: "ALKiln: Run tests"
93
+ if: ${{ success() }}
94
+ run: alkiln-run @e6 or @al1
95
+ shell: bash
96
+
97
+ # run: alkiln-run ${{ github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
98
+
99
+ # on playground, delete project
100
+ - name: "ALKiln: Try to delete the project from the playground of the docassemble test account."
101
+ if: ${{ inputs.INSTALL_METHOD == 'playground' }}
102
+ run: alkiln-takedown
103
+ shell: bash
104
+
105
+ # Upload artifacts that subscribers can download on the Actions summary page
106
+ - name: "ALKiln: Upload artifacts folder"
107
+ if: ${{ always() }}
108
+ uses: actions/upload-artifact@v3
109
+ with:
110
+ name: ${{ env.ARTIFACT_NAME }}
111
+ path: ./alkiln-*
111
112
 
112
113
  # ##################################
113
114
  # # A developer's workflow should look similar to the below
@@ -1,6 +1,12 @@
1
1
  name: "ALKiln/github_server: Isolated docassemble tests"
2
2
  description: "Download and start up a temporary docassemble server on GitHub's servers, in an isolated environment. Avoids docassemble reload errors and other external factors."
3
3
 
4
+ # Wat?
5
+ # https://github.com/SuffolkLITLab/ALKiln/actions/runs/5912900256/job/16036751264#step:4:188
6
+ # Had no completion messages, but it exited with an error anyway
7
+ # Took 121 seconds
8
+ # The rerun of the test completed that step just fine, though it took less time
9
+ # Took 120 and was fine: https://github.com/SuffolkLITLab/ALKiln/actions/runs/5913167036/job/16037288791
4
10
 
5
11
  inputs:
6
12
  CONFIG_CONTENTS:
@@ -27,6 +33,9 @@ runs:
27
33
  run: |
28
34
  echo "DA_ADMIN_API_KEY=abcd1234abcd1234abcd5678abdc5678" >> $GITHUB_ENV
29
35
  echo "MAX_SECONDS_FOR_DOCKER=${{ inputs.MAX_SECONDS_FOR_DOCKER }}" >> $GITHUB_ENV
36
+ echo "CLONE_URL=${{ github.server_url }}/${{ github.repository }}.git" >> $GITHUB_ENV
37
+ echo "OWNER_AND_REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV
38
+ echo "BRANCH_REF=${{ github.ref }}" >> $GITHUB_ENV
30
39
  shell: bash
31
40
  - id: api_key_output_step
32
41
  run: echo "::set-output name=DOCASSEMBLE_DEVELOPER_API_KEY::$DA_ADMIN_API_KEY"
@@ -47,8 +56,8 @@ runs:
47
56
  # Wait 1 minute before pinging the server constantly
48
57
  sleep 60
49
58
 
50
- # Use a variable we can control to avoid race conditions from
51
- # preventing the success log message.
59
+ # Use a variable instead of checking $result so we can control to avoid race
60
+ # conditions from preventing the success log message.
52
61
  ready="false"
53
62
 
54
63
  while [[ $ready == "false" ]]; do
@@ -62,8 +71,8 @@ runs:
62
71
  break
63
72
  fi
64
73
 
65
- # Set the variable to a new string value in each iteration
66
- result=$(curl -s localhost)
74
+ ## Set the variable to a new string value in each iteration
75
+ #result=$(curl -s localhost)
67
76
 
68
77
  # Check if the string includes the desired text
69
78
  if [[ ! $result == *"Docassemble is starting"* ]]; then
@@ -76,6 +85,37 @@ runs:
76
85
 
77
86
  done
78
87
  shell: bash
88
+
89
+ - name: Install the package
90
+ run: |
91
+ echo $CLONE_URL
92
+ git clone $CLONE_URL
93
+
94
+ # Split the full repository name by '/' and get the last element (repo name)
95
+ IFS='/' read -ra repo_parts <<< "$OWNER_AND_REPO_NAME"
96
+ repo_name=${repo_parts[-1]}
97
+ echo $repo_name
98
+ cd $repo_name
99
+
100
+ echo "branch ref $BRANCH_REF"
101
+ ref_name=$BRANCH_REF
102
+ branch_name="${ref_name#refs/heads/}"
103
+ echo "branch name: $branch_name"
104
+ git checkout -b $branch_name
105
+ git fetch origin $branch_name
106
+ git reset --hard origin/$branch_name
107
+
108
+ cd ..
109
+ pip install docassemblecli
110
+ dainstall $repo_name --apiurl http://localhost --apikey $DA_ADMIN_API_KEY
111
+
112
+ ## Below here is just for development
113
+ #container_name=$(docker ps --format '{{.Names}}' | head -n 1)
114
+ #echo $container_name
115
+ #docker exec -it "$container_name /bin/bash"
116
+ #echo "ls /usr/share/docassemble/local3.10/lib/python3.10/site-packages/docassemble"
117
+ shell: bash
118
+
79
119
  - name: Docker logs
80
120
  if: ${{ always() }}
81
121
  # TODO: create an arifact for this instead
@@ -56,12 +56,12 @@ const startserver = async () => {
56
56
  await browser.close();
57
57
  */
58
58
 
59
- let task_id = await da_i.install_on_server();
60
- if (task_id) {
61
- console.log("Waiting...")
62
- await da_i.wait_for_package_to_restart(task_id);
63
- }
64
- console.log("Done!")
59
+ // let task_id = await da_i.install_on_server();
60
+ // if (task_id) {
61
+ // console.log("Waiting...")
62
+ // await da_i.wait_for_package_to_restart(task_id);
63
+ // }
64
+ // console.log("Done!")
65
65
  session_vars.save_install_type("server");
66
66
 
67
67
  }; // Ends startserver();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.0.2-feat-github-server-7",
3
+ "version": "5.0.2-feat-github-server-8",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -1,61 +0,0 @@
1
- import os
2
- import sys
3
- from setuptools import setup, find_packages
4
- from fnmatch import fnmatchcase
5
- from distutils.util import convert_path
6
-
7
- standard_exclude = ('*.pyc', '*~', '.*', '*.bak', '*.swp*')
8
- standard_exclude_directories = ('.*', 'CVS', '_darcs', './build', './dist', 'EGG-INFO', '*.egg-info')
9
-
10
- def find_package_data(where='.', package='', exclude=standard_exclude, exclude_directories=standard_exclude_directories):
11
- out = {}
12
- stack = [(convert_path(where), '', package)]
13
- while stack:
14
- where, prefix, package = stack.pop(0)
15
- for name in os.listdir(where):
16
- fn = os.path.join(where, name)
17
- if os.path.isdir(fn):
18
- bad_name = False
19
- for pattern in exclude_directories:
20
- if (fnmatchcase(name, pattern)
21
- or fn.lower() == pattern.lower()):
22
- bad_name = True
23
- break
24
- if bad_name:
25
- continue
26
- if os.path.isfile(os.path.join(fn, '__init__.py')):
27
- if not package:
28
- new_package = name
29
- else:
30
- new_package = package + '.' + name
31
- stack.append((fn, '', new_package))
32
- else:
33
- stack.append((fn, prefix + name + '/', package))
34
- else:
35
- bad_name = False
36
- for pattern in exclude:
37
- if (fnmatchcase(name, pattern)
38
- or fn.lower() == pattern.lower()):
39
- bad_name = True
40
- break
41
- if bad_name:
42
- continue
43
- out.setdefault(package, []).append(prefix+name)
44
- return out
45
-
46
- setup(name='docassemble.ALKiln',
47
- version='0.0.1',
48
- description=('A docassemble extension.'),
49
- long_description='# docassemble.ALKiln\r\n\r\nA docassemble extension.\r\n\r\nALKiln, or Assembly Line Kiln, is an open source project that helps [docassemble](https://docassemble.org/) developers create automated tests for their interviews (online forms). It works well with the [Document Assembly Line Project](https://suffolklitlab.org/docassemble-AssemblyLine-documentation) but is independent of it.\r\n\r\n',
50
- long_description_content_type='text/markdown',
51
- author='plocket',
52
- author_email='52798256+plocket@users.noreply.github.com',
53
- license='The MIT License (MIT)',
54
- url='https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln',
55
- packages=find_packages(),
56
- namespace_packages=['docassemble'],
57
- install_requires=[],
58
- zip_safe=False,
59
- package_data=find_package_data(where='docassemble/ALKiln/', package='docassemble.ALKiln'),
60
- )
61
-