Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close #760, use dainstall so PRs can test too #823

Merged
merged 16 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/github_server.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: GitHub server tests
name: GitHub server installation

on:
push:
# Default opened, reopened, synchronize. "edited" is something else.
pull_request_target:
workflow_dispatch:
inputs:
tags:
Expand Down Expand Up @@ -33,7 +35,9 @@ jobs:
SECRET_FOR_MISSING_FIELD: secret for missing field

steps:
# Place the root directory in this branch
#### Developer note: You probably don't need this
# Place the root directory in this branch to access
# relative paths to action files
- uses: actions/checkout@v3

- name: ALKiln - Start the isolated temporary docassemble server on GitHub
Expand Down Expand Up @@ -83,7 +87,5 @@ jobs:
INSTALL_METHOD: "server"
#### Developer note: Useful for temporarily shortening ALKiln tests
#### to debug the docker install step
# ALKILN_TAG_EXPRESSION: @onetest
- run: echo "ALkiln finished running ALKiln tests"
shell: bash
# ALKILN_TAG_EXPRESSION: @a_tag_expression

56 changes: 56 additions & 0 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Playground installation

on:
push:
# Default: opened, reopened, synchronize. "edited" is not what we want.
pull_request_target:
workflow_dispatch:
inputs:
tags:
required: False
description: 'Optional. Use a "tag expression" specify which tagged tests to run (https://cucumber.io/docs/cucumber/api/#tag-expressions)'
default: ''

jobs:

puppeteer-tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

env:
#### Developer note: Required
SERVER_URL: ${{ secrets.SERVER_URL }}
DOCASSEMBLE_DEVELOPER_API_KEY: ${{ secrets.DOCASSEMBLE_DEVELOPER_API_KEY }}
#### Developer note: you don't need any of these
# Specific to our repo's tests
PLAYGROUND_EMAIL: ${{ secrets.PLAYGROUND_EMAIL }}
PLAYGROUND_PASSWORD: ${{ secrets.PLAYGROUND_PASSWORD }}
PLAYGROUND_ID: ${{ secrets.PLAYGROUND_ID }}
USER1_EMAIL: ${{ secrets.USER1_EMAIL }}
USER1_PASSWORD: ${{ secrets.USER1_PASSWORD }}
SECRET_VAR1: secret-var1-value
SECRET_VAR2: secret-var2-value
SECRET_FOR_MISSING_FIELD: secret for missing field
# Internal
_ORIGIN: github

name: Run ALKiln tests
steps:
#### Developer note: You probably don't need this
# Place the root directory in this branch to access
# relative paths to action files
- uses: actions/checkout@v3

#### Developer note: you'll need to replace `.` with the path to
#### the repo and branch and leave off the trailing `/`
#### For example suffolkLITLab/ALKiln@v5
- uses: ./
with:
SERVER_URL: "${{ env.SERVER_URL }}"
DOCASSEMBLE_DEVELOPER_API_KEY: "${{ env.DOCASSEMBLE_DEVELOPER_API_KEY }}"
#### Developer note: Useful for temporarily shortening ALKiln tests
#### to debug the docker install step
# ALKILN_TAG_EXPRESSION: @a_tag_expression
73 changes: 0 additions & 73 deletions .github/workflows/test_tests.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Unit tests

on:
push:
workflow_dispatch:

jobs:

unit-tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

name: Run unit tests
steps:
- name: Set name of artifact folder with date and UTC 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
run: |
echo "UNIT_TESTS_ARTIFACT_NAME=_alkiln-misc-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run unit
# Artifacts
- name: upload unit tests artifacts folder
uses: actions/upload-artifact@v3
# This will upload even if a previous step has failed
if: ${{ always() }}
with:
name: ${{ env.UNIT_TESTS_ARTIFACT_NAME }}
path: ./_alkiln-*
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,17 @@ Format:
-
-->

<!-- ## [Unreleased] -->
## [Unreleased]

### Added
- Allow tests to run when a PR is made by switching to docassemblecli's `dainstall` to upload packagese to the Playground. See [#760](https://github.com/SuffolkLITLab/ALKiln/issues/760).

### Internal
- Workflows:
- Split unit tests into their own file. They have to use `npm install` in our repo and we don't want to use that for Playground tests. It avoids trying to push all the node modules to the Playground which would otherwise cause error 413 "too large".
- Use our own action in the tests that install on the Playground, to avoid duplicating edits to the action - see [#822](https://github.com/SuffolkLITLab/ALKiln/issues/822).
- Rename files
- Also see [#822](https://github.com/SuffolkLITLab/ALKiln/issues/822)

## [5.6.0] - 2023-10-27

Expand Down
46 changes: 32 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ inputs:
runs:
using: "composite"
steps:
# Place the root directory in this branch
- uses: actions/checkout@v3

# Set environment variables
- name: "ALKiln: Set environment variables"
- name: "ALKiln setup info: Set environment variables"
# 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
run: |
# ALKiln setup info: Set environment variables
echo "ARTIFACT_NAME=alkiln-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
echo "BRANCH_PATH=${{ github.ref }}" >> $GITHUB_ENV
Expand All @@ -50,59 +54,75 @@ runs:
echo "SERVER_RELOAD_TIMEOUT_SECONDS=${{ inputs.SERVER_RELOAD_TIMEOUT_SECONDS }}" >> $GITHUB_ENV
echo "_ORIGIN=github" >> $GITHUB_ENV
shell: bash
- name: "ALKiln: confirm info"
- name: "ALKiln setup info: confirm environment variables"
run: |
# ALKiln setup info: confirm environment variables
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"
shell: bash

# Install
- name: "ALKiln: Install node packages"
- name: "ALKiln setup info: Install node packages"
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install ALKiln directly from npm
run: |
# ALKiln setup info: Install ALKiln directly from npm
npm install -g @suffolklitlab/alkiln@$ALKILN_VERSION
shell: bash

# Install on playground
- name: "ALKiln: Create a Project and pull the package from GitHub"

# Don't rely on the environment's version of python
- uses: actions/setup-python@v4
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
with:
python-version: '3.10'
- name: "ALKiln: Create a Project and install the package from GitHub"
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
run: alkiln-setup
run: |
# ALKiln setup info: Create a Project and install the package from GitHub
pip3 install docassemblecli
alkiln-setup
shell: bash
- run: echo -e "\n\n====\nALKiln could not create a project on your server's testing account or pull your package into it. Check the messages above this line.\n\n"
- name: "ALKiln setup ERROR"
run: echo -e "\n\n====\nALKiln ERROR - could not create a project on your server's testing account or pull your package into it. Check the messages above this line.\n\n"
if: ${{ inputs.INSTALL_METHOD == 'playground' && failure() }}
shell: bash

# Install on server
- name: "ALKiln: Install the GitHub package onto the server"
# Server installations - find folders and save session vars
- name: "ALKiln setup info: Install the GitHub package onto the server"
if: ${{ inputs.INSTALL_METHOD == 'server' }}
run: alkiln-server-install
shell: bash
- run: echo -e "\n\n====\nALKiln could not install the package on the temporary GitHub docassemble server. Check the steps above this line.\n\n"
- name: "ALKiln setup ERROR"
run: echo -e "\n\n====\nALKiln ERROR - could not install the package on the temporary GitHub docassemble server. Check the steps above this line.\n\n"
if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
shell: bash

# run tests
- name: "ALKiln: Run tests"
- name: "ALKiln info: Run tests"
if: ${{ success() }}
run: alkiln-run ${{ inputs.ALKILN_TAG_EXPRESSION || github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
shell: bash

# on playground, delete project
- name: "ALKiln: Try to delete the project from the playground of the docassemble test account."
- name: "ALKiln info: Try to delete the project from the playground of the docassemble test account."
if: ${{ inputs.INSTALL_METHOD == 'playground' }}
run: alkiln-takedown
shell: bash

# Upload artifacts that subscribers can download on the Actions summary page
- name: "ALKiln: Upload artifacts folder"
- name: "ALKiln info: Upload artifacts folder"
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./alkiln-*

- run: echo "ALkiln finished running tests"
shell: bash

# ##################################
# # A developer's workflow should look similar to the below.
# # In place of `uses: suffolkLITLab/ALKiln@v5`, they
Expand All @@ -123,10 +143,8 @@ runs:
# runs-on: ubuntu-latest
# name: Run interview tests
# steps:
# - uses: actions/checkout@v3
# - name: Use ALKiln to run tests
# uses: suffolkLITLab/ALKiln@v5
# with:
# SERVER_URL: "${{ secrets.SERVER_URL }}"
# DOCASSEMBLE_DEVELOPER_API_KEY: "${{ secrets.DOCASSEMBLE_DEVELOPER_API_KEY }}"
# - run: echo "Finished running ALKiln tests"
Loading