Skip to content

Commit

Permalink
test: add action tests (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlp-craigmorten authored Feb 1, 2024
1 parent fc6ef1e commit e720964
Show file tree
Hide file tree
Showing 13 changed files with 170 additions and 26 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '34 4 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
continue-on-error: true
75 changes: 75 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 0 1 * *" # 1 day of every month

jobs:
test-macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12, macos-13]
record: [true, false]
ignoreTccDb: [true, false]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Guidepup Setup
uses: ./
with:
record: ${{ matrix.record }}
ignoreTccDb: ${{ matrix.ignoreTccDb }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: artifacts
path: |
**/recordings/**/*
test-macos-14:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14]
record: [true, false]
ignoreTccDb: [true]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Guidepup Setup
uses: ./
with:
record: ${{ matrix.record }}
ignoreTccDb: ${{ matrix.ignoreTccDb }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: artifacts
path: |
**/recordings/**/*
test-windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019, windows-2022]
nvdaInstallDir: ["", "D:\\a\\setup-action\\setup-action\\nvda"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Guidepup Setup
uses: ./
with:
nvdaInstallDir: ${{ matrix.nvdaInstallDir }}
- run: Get-ChildItem ${{ matrix.nvdaInstallDir }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ If updating the TCC.db is not possible (due to SIP) or required you can skip the
```

> [!NOTE]
> If the necessary permissions have not been granted by other means, using this flag may result in your environment not being setup for reliable screen reader automation.
> If the necessary permissions have not been granted by other means, using this flag may result in your environment not being set up for reliable screen reader automation.

### Windows

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
ignoreTccDb:
description: "Ignore TCC.db updates if not possible or required for your environment. Default is not to ignore. macos agents only."
required: false
default: ""
default: false
nvdaInstallDir:
description: "Specify a custom location for where to install NVDA. Default is to install to a temporary directory. windows agents only."
required: false
Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const exec = require("@actions/exec");

async function main() {
try {
if (os.platform === "darwin") {
if (os.platform() === "darwin") {
// Fix for GitHub actions macos-11 screencapture not working
// REF: https://github.com/actions/runner-images/issues/5960
const width = core.getInput("resolutionWidth") || "1920";
Expand All @@ -32,7 +32,7 @@ async function main() {
}
}

if (os.platform === "win32") {
if (os.platform() === "win32") {
const nvdaInstallDirectory = core.getInput("nvdaInstallDir") ?? null;

if (nvdaInstallDirectory) {
Expand All @@ -43,6 +43,7 @@ async function main() {

// Run generic screen reader setup
process.argv.push("--ci");

require("@guidepup/setup");
} catch (err) {
core.setFailed(err);
Expand Down
4 changes: 2 additions & 2 deletions node_modules/.yarn-integrity

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

3 changes: 2 additions & 1 deletion node_modules/@guidepup/setup/README.md

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

2 changes: 1 addition & 1 deletion node_modules/@guidepup/setup/lib/logging.d.ts

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

15 changes: 4 additions & 11 deletions node_modules/@guidepup/setup/lib/logging.js

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

3 changes: 3 additions & 0 deletions node_modules/@guidepup/setup/lib/macOS/setup.js

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

2 changes: 1 addition & 1 deletion node_modules/@guidepup/setup/package.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
@@ -1,6 +1,6 @@
{
"name": "@guidepup/setup-action",
"version": "0.15.0",
"version": "0.15.1",
"description": "GitHub Action to setup your environment for screen reader test automation.",
"main": "index.js",
"author": "Craig Morten <craig.morten@hotmail.co.uk>",
Expand All @@ -23,6 +23,6 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@guidepup/setup": "^0.15.0"
"@guidepup/setup": "^0.15.1"
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
semver "^7.3.8"
shelljs "^0.8.5"

"@guidepup/setup@^0.15.0":
version "0.15.0"
resolved "https://registry.yarnpkg.com/@guidepup/setup/-/setup-0.15.0.tgz#a8c2b9451b7085c5b839129f3b65ac1649ea1a39"
integrity sha512-nrbmF6qXD5IftLaZ1jBYZzDSU+yhpzPPNfDrtF1xQPa0GdGGhVHMoX63jCz6laIRNBIHHR5vyI0NtGSOB70jXA==
"@guidepup/setup@^0.15.1":
version "0.15.1"
resolved "https://registry.yarnpkg.com/@guidepup/setup/-/setup-0.15.1.tgz#66aa64611e2b42f0e26ac05768c1624c5e8e8f3f"
integrity sha512-FkTmyrnpvtoPCGXKdjdVWGu0KtHJg/KST2spjU9EJhj50S0wMyeLNfgMQ6k8tSQN4zY0d/a1Avh8A9N4bPQm/w==
dependencies:
"@guidepup/guidepup" "^0.22.0"
chalk "^4.0.0"
Expand Down

0 comments on commit e720964

Please sign in to comment.