Skip to content

Commit

Permalink
Chore/typescript actions (#351)
Browse files Browse the repository at this point in the history
* Update Dockerfile for TypeScript

* Move TypeScript from devDependencies to deps

* Force exit code 0 in npm run build step

* Update docker-test.yml to run npm cli

* Rename setup scripts folder

* Restore verapdf-auto-install-macos.xml

* Restore verapdf-auto-install-windows.xml

* Update npm run build in ps1 and cmd action scripts
  • Loading branch information
younglim authored Jun 4, 2024
1 parent 895aac3 commit 00ac9ce
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 15 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ jobs:

- name: Build and run Docker container
run: |
# Build your Docker image (replace 'purple-hats' and 'Dockerfile' with your image name and Dockerfile path)
docker build -t purple-hats .
# Build your Docker image (replace 'purple-a11y' and 'Dockerfile' with your image name and Dockerfile path)
docker build -t purple-a11y .
# Run the Docker container (adjust any options as needed)
docker run -dit --name purple-hats-container purple-hats
docker run -dit --name purple-a11y-container purple-a11y
# Ensure the Docker container is running before running the next step
continue-on-error: true

- name: Run Node CLI command inside the Docker container
run: |
# Execute a webisite crawl
docker exec purple-hats-container node cli -u "${{ vars.A11Y_SCAN_URL }}" -c 2 -p "${{ vars.A11Y_SCAN_MAX_NUM_PAGES }}" -t "${{ vars.A11Y_SCAN_MAX_CONCURRENCY }}" -k "${{ github.actor }}:${{ github.actor }}@users.noreply.github.com" -b chromium || true
docker exec purple-a11y-container npm run cli -- -u "${{ vars.A11Y_SCAN_URL }}" -c 2 -p "${{ vars.A11Y_SCAN_MAX_NUM_PAGES }}" -t "${{ vars.A11Y_SCAN_MAX_CONCURRENCY }}" -k "${{ github.actor }}:${{ github.actor }}@users.noreply.github.com" -b chromium || true
- name: Print errors
run: |
docker exec purple-hats-container cat errors.txt || true
docker exec purple-a11y-container cat errors.txt || true
- name: Print logs
run: |
docker exec purple-hats-container cat logs/*/*.txt || true
docker exec purple-a11y-container cat logs/*/*.txt || true
- name: Copy Results from Docker Container
run: docker cp purple-hats-container:/app/results ./results
run: docker cp purple-a11y-container:/app/results ./results

- name: Zip Results
run: zip -r results.zip ./results
Expand All @@ -50,5 +50,5 @@ jobs:
- name: Cleanup Docker container
run: |
# Stop and remove the Docker container
docker stop purple-hats-container
docker rm purple-hats-container
docker stop purple-a11y-container
docker rm purple-a11y-container
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ USER purple

# Copy application and support files
COPY . .

# Compile TypeScript
RUN npm run build || true # true exits with code 0 - temp workaround until errors are resolved
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"prettier": "^3.1.0",
"print-message": "^3.0.1",
"safe-regex": "^2.1.1",
"typescript": "^5.4.5",
"validator": "^13.11.0",
"which": "^4.0.0",
"winston": "^3.11.0",
Expand All @@ -41,8 +42,7 @@
"eslint-plugin-import": "^2.27.4",
"eslint-plugin-prettier": "^5.0.0",
"globals": "^15.2.0",
"jest": "^29.3.1",
"typescript": "^5.4.5"
"jest": "^29.3.1"
},
"overrides": {
"node-fetch": "^2.3.0",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ fi

echo "Installing Node dependencies to $PWD"
npm ci

echo "Build TypeScript"
npm run build || true
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ if (Test-Path purple-a11y) {
# Write-Output "Install Playwright browsers"
# & ".\a11y_shell_ps.ps1" "npx playwright install chromium"

try {
Write-Output "Building Typescript"
& ".\a11y_shell_ps.ps1" "cd purple-a11y;npm run build"
} catch {
Write-Output "Build with some errors but continuing"
}
if (Test-Path purple-a11y\.git) {
Write-Output "Unhide .git folder"
attrib -s -h purple-a11y\.git
Expand All @@ -84,11 +90,18 @@ if (Test-Path purple-a11y) {

Write-Output "Install Playwright browsers"
& "npx playwright install chromium"

if (Test-Path .git) {
Write-Output "Unhide .git folder"
attrib -s -h .git
}

try {
Write-Output "Building Typescript"
npm run build
} catch {
Write-Output "Build with some errors but continuing"
}

} else {
Write-Output "Could not find purple-a11y"
Expand Down
16 changes: 16 additions & 0 deletions scripts/verapdf-auto-install-macos.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<AutomatedInstallation langpack="eng">
<com.izforge.izpack.panels.htmlhello.HTMLHelloPanel id="welcome"/>
<com.izforge.izpack.panels.target.TargetPanel id="install_dir">
<installpath>/tmp/verapdf</installpath>
</com.izforge.izpack.panels.target.TargetPanel>
<com.izforge.izpack.panels.packs.PacksPanel id="sdk_pack_select">
<pack index="0" name="veraPDF GUI" selected="true"/>
<pack index="1" name="veraPDF Mac and *nix Scripts" selected="true"/>
<pack index="2" name="veraPDF Validation model" selected="false"/>
<pack index="3" name="veraPDF Documentation" selected="false"/>
<pack index="4" name="veraPDF Sample Plugins" selected="false"/>
</com.izforge.izpack.panels.packs.PacksPanel>
<com.izforge.izpack.panels.install.InstallPanel id="install"/>
<com.izforge.izpack.panels.finish.FinishPanel id="finish"/>
</AutomatedInstallation>
16 changes: 16 additions & 0 deletions scripts/verapdf-auto-install-windows.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<AutomatedInstallation langpack="eng">
<com.izforge.izpack.panels.htmlhello.HTMLHelloPanel id="welcome"/>
<com.izforge.izpack.panels.target.TargetPanel id="install_dir">
<installpath>C:\Windows\Temp\verapdf</installpath>
</com.izforge.izpack.panels.target.TargetPanel>
<com.izforge.izpack.panels.packs.PacksPanel id="sdk_pack_select">
<pack index="0" name="veraPDF GUI" selected="true"/>
<pack index="1" name="veraPDF Batch files" selected="true"/>
<pack index="2" name="veraPDF Validation model" selected="false"/>
<pack index="3" name="veraPDF Documentation" selected="false"/>
<pack index="4" name="veraPDF Sample Plugins" selected="false"/>
</com.izforge.izpack.panels.packs.PacksPanel>
<com.izforge.izpack.panels.install.InstallPanel id="install"/>
<com.izforge.izpack.panels.finish.FinishPanel id="finish"/>
</AutomatedInstallation>

0 comments on commit 00ac9ce

Please sign in to comment.