Update action from typescript-action template

This commit is contained in:
Jimver
2025-06-01 14:11:32 +02:00
parent c35baa1a18
commit 2a4f2d20d0
59 changed files with 206006 additions and 135828 deletions
+39 -23
View File
@@ -1,25 +1,41 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:noble",
"features": {
"ghcr.io/devcontainers-contrib/features/volta:1": {}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"name": "GitHub Actions (TypeScript)",
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
"postCreateCommand": "npm install",
"customizations": {
"codespaces": {
"openFiles": ["README.md"]
},
"vscode": {
"extensions": [
"bierner.markdown-preview-github-styles",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"github.copilot",
"github.copilot-chat",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"me-dutour-mathieu.vscode-github-actions",
"redhat.vscode-yaml",
"rvest.vs-code-prettier-eslint",
"yzhang.markdown-all-in-one"
],
"settings": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.formatOnSave": true,
"markdown.extension.list.indentationSize": "adaptive",
"markdown.extension.italic.indicator": "_",
"markdown.extension.orderedList.marker": "one"
}
}
},
"remoteEnv": {
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
}
}
+61
View File
@@ -0,0 +1,61 @@
# dotenv-linter:off IncorrectDelimiter
# Do not commit your actual .env file to Git! This may contain secrets or other
# private information.
# Enable/disable step debug logging (default: `false`). For local debugging, it
# may be useful to set it to `true`.
ACTIONS_STEP_DEBUG=true
# GitHub Actions inputs should follow `INPUT_<name>` format (case-sensitive).
# Hyphens should not be converted to underscores!
INPUT_MILLISECONDS=2400
# GitHub Actions default environment variables. These are set for every run of a
# workflow and can be used in your actions. Setting the value here will override
# any value set by the local-action tool.
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
# CI="true"
# GITHUB_ACTION=""
# GITHUB_ACTION_PATH=""
# GITHUB_ACTION_REPOSITORY=""
# GITHUB_ACTIONS=""
# GITHUB_ACTOR=""
# GITHUB_ACTOR_ID=""
# GITHUB_API_URL=""
# GITHUB_BASE_REF=""
# GITHUB_ENV=""
# GITHUB_EVENT_NAME=""
# GITHUB_EVENT_PATH=""
# GITHUB_GRAPHQL_URL=""
# GITHUB_HEAD_REF=""
# GITHUB_JOB=""
# GITHUB_OUTPUT=""
# GITHUB_PATH=""
# GITHUB_REF=""
# GITHUB_REF_NAME=""
# GITHUB_REF_PROTECTED=""
# GITHUB_REF_TYPE=""
# GITHUB_REPOSITORY=""
# GITHUB_REPOSITORY_ID=""
# GITHUB_REPOSITORY_OWNER=""
# GITHUB_REPOSITORY_OWNER_ID=""
# GITHUB_RETENTION_DAYS=""
# GITHUB_RUN_ATTEMPT=""
# GITHUB_RUN_ID=""
# GITHUB_RUN_NUMBER=""
# GITHUB_SERVER_URL=""
# GITHUB_SHA=""
# GITHUB_STEP_SUMMARY=""
# GITHUB_TRIGGERING_ACTOR=""
# GITHUB_WORKFLOW=""
# GITHUB_WORKFLOW_REF=""
# GITHUB_WORKFLOW_SHA=""
# GITHUB_WORKSPACE=""
# RUNNER_ARCH=""
# RUNNER_DEBUG=""
# RUNNER_NAME=""
# RUNNER_OS=""
# RUNNER_TEMP=""
# RUNNER_TOOL_CACHE=""
-4
View File
@@ -1,4 +0,0 @@
dist/
lib/
node_modules/
jest.config.js
-92
View File
@@ -1,92 +0,0 @@
{
"root": true,
"plugins": [
"jest",
"@typescript-eslint",
"prettier",
"github"
],
"extends": [
"plugin:github/recommended",
"plugin:github/typescript",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.eslint.json"
},
"rules": {
"prettier/prettier": "error",
"filenames/match-regex": [
"error",
"^[a-z0-9-]+(.test)?$"
],
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error"
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"no-shadow": "off",
"@typescript-eslint/no-shadow": [
"error"
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/func-call-spacing": [
"error",
"never"
],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": [
"error",
"never"
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
# Force LF everywhere for prettier
* text eol=lf
* text=auto eol=lf
# Ignore diffs in dist as it is generated code
dist/** -diff linguist-generated=true
+26 -16
View File
@@ -1,20 +1,30 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "devcontainers"
directory: "/"
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
actions-minor:
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
ignore:
- dependency-name: '@types/node'
update-types:
- 'version-update:semver-major'
groups:
npm-development:
dependency-type: development
update-types:
- minor
- patch
npm-production:
dependency-type: production
update-types:
- patch
+17 -14
View File
@@ -20,7 +20,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-2025, windows-2022, ubuntu-24.04, ubuntu-22.04, ubuntu-24.04-arm, ubuntu-22.04-arm]
os:
[
windows-2025,
windows-2022,
ubuntu-24.04,
ubuntu-22.04,
ubuntu-24.04-arm,
ubuntu-22.04-arm
]
method: [local, network]
runs-on: ${{ matrix.os }}
@@ -29,19 +37,12 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# npm cache
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
node-version-file: .node-version
cache: npm
- name: Install npm dependencies
run: npm ci
@@ -67,7 +68,9 @@ jobs:
method: ${{matrix.method}}
log-file-suffix: '${{matrix.method}}-${{matrix.os}}'
- name: Run the action on this runner with nvcc and libcublas subpackages (Linux)
- name:
Run the action on this runner with nvcc and libcublas subpackages
(Linux)
if: runner.os == 'Linux' && matrix.method == 'network'
uses: ./
with:
+51 -38
View File
@@ -1,59 +1,72 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/
# In TypeScript actions, `dist/` is a special directory. When you reference
# an action with the `uses:` property, `dist/index.js` is the code that will be
# run. For this project, the `dist/index.js` file is transpiled from other
# source files. This workflow ensures the `dist/` directory contains the
# expected transpiled code.
#
# If this workflow is run from a feature branch, it will act as an additional CI
# check and fail if the checked-in `dist/` directory does not match what is
# expected from the build.
name: Check Transpiled JavaScript
on:
pull_request:
branches:
- main
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
permissions:
contents: read
jobs:
check-dist:
name: Check dist/
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Set Node.js
uses: actions/[email protected]
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
node-version-file: .node-version
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Install Dependencies
id: install
run: npm ci
- name: Rebuild the dist/ directory
- name: Build dist/ Directory
id: build
run: npm run bundle
# This will fail the workflow if the `dist/` directory is different than
# expected.
- name: Compare Directories
id: diff
run: |
npm run build
npm run package
- name: correct vercel/ncc crlf output
run: |
# See https://github.com/vercel/ncc/issues/638
sed -i 's/\x0D$//' ./dist/*
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
if [ ! -d dist/ ]; then
echo "Expected dist/ directory does not exist. See status below:"
ls -la ./
exit 1
fi
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
# If `dist/` was different than expected, upload the expected version as a
# workflow artifact.
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: dist-${{ github.job }}
name: dist
path: dist/
-54
View File
@@ -1,54 +0,0 @@
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
- cron: '30 1 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'TypeScript' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
source-root: src
# 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
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
+48
View File
@@ -0,0 +1,48 @@
name: CodeQL
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: '31 7 * * 3'
permissions:
actions: read
checks: write
contents: read
security-events: write
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language:
- TypeScript
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Initialize CodeQL
id: initialize
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
source-root: src
- name: Autobuild
id: autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
id: analyze
uses: github/codeql-action/analyze@v3
+74
View File
@@ -0,0 +1,74 @@
# This workflow checks the statuses of cached dependencies used in this action
# with the help of the Licensed tool. If any licenses are invalid or missing,
# this workflow will fail. See: https://github.com/licensee/licensed
name: Licensed
on:
# Uncomment the below lines to run this workflow on pull requests and pushes
# to the default branch. This is useful for checking licenses before merging
# changes into the default branch.
pull_request:
branches:
- master
push:
branches:
- master
workflow_dispatch:
permissions:
contents: write
jobs:
licensed:
name: Check Licenses
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install Dependencies
id: npm-ci
run: npm ci
- name: Setup Ruby
id: setup-ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby
- uses: licensee/[email protected]
with:
version: 4.x
github_token: ${{ secrets.GITHUB_TOKEN }}
# If this is a workflow_dispatch event, update the cached licenses.
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update Licenses
id: update-licenses
run: licensed cache
# Then, commit the updated licenses to the repository.
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Commit Licenses
id: commit-licenses
run: |
git config --local user.email "[email protected]"
git config --local user.name "licensed-ci"
git add .
git commit -m "Auto-update license files"
git push
# Last, check the status of the cached licenses.
- name: Check Licenses
id: check-licenses
run: licensed status
+53
View File
@@ -0,0 +1,53 @@
name: Lint Codebase
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: read
packages: read
statuses: write
jobs:
lint:
name: Lint Codebase
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install Dependencies
id: install
run: npm ci
- name: Lint Codebase
id: super-linter
uses: super-linter/super-linter/slim@v7
env:
DEFAULT_BRANCH: main
FILTER_REGEX_EXCLUDE: dist/**/*
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: ${{ github.workspace }}
VALIDATE_ALL_CODEBASE: true
VALIDATE_JAVASCRIPT_ES: false
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_JSCPD: false
VALIDATE_TYPESCRIPT_ES: false
VALIDATE_JSON: false
VALIDATE_TYPESCRIPT_STANDARD: false
+4 -1
View File
@@ -96,4 +96,7 @@ Thumbs.db
# Ignore built ts files
__tests__/runner/*
lib/
# IDE files
.idea
*.code-workspace
+18
View File
@@ -0,0 +1,18 @@
# See: https://github.com/licensee/licensed/blob/main/docs/configuration.md
sources:
npm: true
allowed:
- apache-2.0
- bsd-2-clause
- bsd-3-clause
- isc
- mit
- cc0-1.0
- other
ignored:
npm:
# Used by Rollup.js when building in GitHub Actions
- '@rollup/rollup-linux-x64-gnu'
+24
View File
@@ -0,0 +1,24 @@
# See: https://github.com/DavidAnson/markdownlint
# Unordered list style
MD004:
style: dash
# Disable line length for tables
MD013:
tables: false
# Ordered list item prefix
MD029:
style: one
# Spaces after list markers
MD030:
ul_single: 1
ol_single: 1
ul_multi: 1
ol_multi: 1
# Code block style
MD046:
style: fenced
+1
View File
@@ -0,0 +1 @@
20.18.1
+3 -2
View File
@@ -1,4 +1,5 @@
.DS_Store
.licenses/
dist/
lib/
node_modules/
tsconfig.json
coverage/
-10
View File
@@ -1,10 +0,0 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
}
+16
View File
@@ -0,0 +1,16 @@
# See: https://prettier.io/docs/en/configuration
printWidth: 80
tabWidth: 2
useTabs: false
semi: false
singleQuote: true
quoteProps: as-needed
jsxSingleQuote: false
trailingComma: none
bracketSpacing: true
bracketSameLine: true
arrowParens: always
proseWrap: always
htmlWhitespaceSensitivity: css
endOfLine: lf
+15
View File
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Action",
"type": "node",
"request": "launch",
"runtimeExecutable": "npx",
"cwd": "${workspaceRoot}",
"args": ["@github/local-action", ".", "src/main.ts", ".env"],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
]
}
+14
View File
@@ -0,0 +1,14 @@
# See: https://yamllint.readthedocs.io/en/stable/
rules:
document-end: disable
document-start:
level: warning
present: false
line-length:
level: warning
max: 80
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
ignore:
- .licenses/
+7
View File
@@ -0,0 +1,7 @@
############################################################################
# Repository CODEOWNERS #
# Order is important! The last matching pattern takes the most precedence. #
############################################################################
# Default owners, unless a later match takes precedence.
* @actions/actions-oss-maintainers
+21 -13
View File
@@ -2,32 +2,40 @@
## Adding new CUDA versions
All CUDA versions are visible on the [NVIDIA CUDA toolkit archive](https://developer.nvidia.com/cuda-toolkit-archive)
All CUDA versions are visible on the
[NVIDIA CUDA toolkit archive](https://developer.nvidia.com/cuda-toolkit-archive)
When adding new versions, the following files should be updated:
- `src/links/linux-links.ts`
To get the linux link you should get the link for the `runfile (local)` option, the distribution doesn't matter as long as the architecture is `x86_64`, see the image below:
![Linux link copy](images/linux-link.jpg)
Copy the link and paste it in a new entry of the `cudaVersionToURL` map:
To get the linux link you should get the link for the `runfile (local)`
option, the distribution doesn't matter as long as the architecture is
`x86_64`, see the image below: ![Linux link copy](images/linux-link.jpg) Copy
the link and paste it in a new entry of the `cudaVersionToURL` map:
![Linux link paste](images/linux-link-code.jpg)
- `src/links/windows-links.ts`
There are two windows links, one for the network installer (online) and one for the local installer (offline):
The installer links can be copied by selecting the Windows platform, OS version doesn't matter (at the time of writing), and then select either `exe (local)` for the local installer, and `exe (network)` for the online installer. The link can be copied by right clicking the green `Download` button and selecting `Copy Link address`.
There are two windows links, one for the network installer (online) and one
for the local installer (offline):
The installer links can be copied by selecting the Windows platform, OS
version doesn't matter (at the time of writing), and then select either
`exe (local)` for the local installer, and `exe (network)` for the online
installer. The link can be copied by right clicking the green `Download`
button and selecting `Copy Link address`.
#### Windows - Local installer:
![Windows link local copy](images/windows-link-local.jpg)
Then add a new entry in the `cudaVersionToURL` map with the link copied above:
![Windows link local paste](images/windows-link-local-code.jpg)
#### Windows - Network installer:
![Windows link network copy](images/windows-link-network.jpg)
Add a new entry in the `cudaVersionToNetworkUrl` map with the link copied in the above:
![Windows link network paste](images/windows-link-network-code.jpg)
Add a new entry in the `cudaVersionToNetworkUrl` map with the link copied in
the above: ![Windows link network paste](images/windows-link-network-code.jpg)
+37 -19
View File
@@ -1,50 +1,66 @@
# cuda-toolkit
This action installs the [NVIDIA® CUDA® Toolkit](https://developer.nvidia.com/cuda-toolkit) on the system. It adds the cuda install location as `CUDA_PATH` to `GITHUB_ENV` so you can access the CUDA install location in subsequent steps. `CUDA_PATH/bin` is added to `GITHUB_PATH` so you can use commands such as `nvcc` directly in subsequent steps. Right now both `windows-2019` and `ubuntu-20.04` runners have been tested to work successfully.
This action installs the
[NVIDIA® CUDA® Toolkit](https://developer.nvidia.com/cuda-toolkit) on the
system. It adds the cuda install location as `CUDA_PATH` to `GITHUB_ENV` so you
can access the CUDA install location in subsequent steps. `CUDA_PATH/bin` is
added to `GITHUB_PATH` so you can use commands such as `nvcc` directly in
subsequent steps. Right now both `windows-2019` and `ubuntu-20.04` runners have
been tested to work successfully.
## Inputs
### `cuda`
**Optional** The CUDA version to install. View `src/link/windows-links.ts` and `src/link/linux-links.ts` for available versions.
**Optional** The CUDA version to install. View `src/link/windows-links.ts` and
`src/link/linux-links.ts` for available versions.
Default: `'12.9.0'`.
### `sub-packages`
**NOTE: On Linux this only works with the 'network' method [view details](#method)**
**NOTE: On Linux this only works with the 'network' method
[view details](#method)**
**Optional**
If set, only the specified CUDA subpackages will be installed.
Only installs specified subpackages, must be in the form of a JSON array. For example, if you only want to install nvcc and visual studio integration: `'["nvcc", "visual_studio_integration"]'` (double quotes required)
**Optional** If set, only the specified CUDA subpackages will be installed. Only
installs specified subpackages, must be in the form of a JSON array. For
example, if you only want to install nvcc and visual studio integration:
`'["nvcc", "visual_studio_integration"]'` (double quotes required)
Default: `'[]'`.
### `non-cuda-sub-packages`
**NOTE: This only works on Linux with the 'network' method [view details](#method)**
**NOTE: This only works on Linux with the 'network' method
[view details](#method)**
**Optional**
If set, only the specified CUDA subpackages will be installed without prepending the "cuda-" prefix.
Only installs specified subpackages without prepending the "cuda-" prefix, must be in the form of a JSON array. For example, if you only want to install libcublas and libcufft: `'["libcublas", "libcufft"]'` (double quotes required)
**Optional** If set, only the specified CUDA subpackages will be installed
without prepending the "cuda-" prefix. Only installs specified subpackages
without prepending the "cuda-" prefix, must be in the form of a JSON array. For
example, if you only want to install libcublas and libcufft:
`'["libcublas", "libcufft"]'` (double quotes required)
Default: `'[]'`.
### `method`
**Optional**
Installation method, can be either `'local'` or `'network'`.
**Optional** Installation method, can be either `'local'` or `'network'`.
- `'local'` downloads the entire installer with all packages and runs that (you can still only install certain packages with `sub-packages` on Windows).
- `'network'` downloads a smaller executable which only downloads necessary packages which you can define in `sub-packages`.
- `'local'` downloads the entire installer with all packages and runs that (you
can still only install certain packages with `sub-packages` on Windows).
- `'network'` downloads a smaller executable which only downloads necessary
packages which you can define in `sub-packages`.
Default: `'local'`.
### `linux-local-args`
**Optional**
(For Linux and 'local' method only) override arguments for the Linux `.run` installer. For example if you don't want samples use `'["--toolkit"]'` (double quotes required)
See the [Nvidia Docs](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile-advanced) for available options. Note that the `--silent` option is already always added by the action itself.
**Optional** (For Linux and 'local' method only) override arguments for the
Linux `.run` installer. For example if you don't want samples use
`'["--toolkit"]'` (double quotes required) See the
[Nvidia Docs](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile-advanced)
for available options. Note that the `--silent` option is already always added
by the action itself.
Default: `'["--toolkit", "--samples"]'`.
@@ -52,8 +68,10 @@ Default: `'["--toolkit", "--samples"]'`.
**Required with matrix builds**
Add suffix to the log file name which gets uploaded as an artifact. This **has** to be set when running a matrix build.
The log file already contains the OS type (Linux/Windows) and install method (local/network) but it is not aware of other matrix variables, so add those here.
Add suffix to the log file name which gets uploaded as an artifact. This **has**
to be set when running a matrix build. The log file already contains the OS type
(Linux/Windows) and install method (local/network) but it is not aware of other
matrix variables, so add those here.
For example if you use multiple linux distros:
+10
View File
@@ -0,0 +1,10 @@
import type * as core from '@actions/core'
import { jest } from '@jest/globals'
export const debug = jest.fn<typeof core.debug>()
export const error = jest.fn<typeof core.error>()
export const info = jest.fn<typeof core.info>()
export const getInput = jest.fn<typeof core.getInput>()
export const setOutput = jest.fn<typeof core.setOutput>()
export const setFailed = jest.fn<typeof core.setFailed>()
export const warning = jest.fn<typeof core.warning>()
+3
View File
@@ -0,0 +1,3 @@
import { jest } from '@jest/globals'
export const wait = jest.fn<typeof import('../src/wait.js').wait>()
+2 -1
View File
@@ -1,4 +1,4 @@
import {CPUArch, getArch} from '../src/arch'
import { CPUArch, getArch } from '../src/arch'
import os from 'os'
test.concurrent('Return either x64 or arm64 architecture', async () => {
@@ -12,6 +12,7 @@ test.concurrent('Return either x64 or arm64 architecture', async () => {
expected = CPUArch.arm64
break
default:
// eslint-disable-next-line jest/no-conditional-expect
await expect(getArch()).rejects.toThrow(
`Unsupported architecture: ${archString}`
)
+4 -3
View File
@@ -1,6 +1,6 @@
import {LinuxLinks} from '../../src/links/linux-links'
import {WindowsLinks} from '../../src/links/windows-links'
import {getLinks} from '../../src/links/get-links'
import { LinuxLinks } from '../../src/links/linux-links'
import { WindowsLinks } from '../../src/links/windows-links'
import { getLinks } from '../../src/links/get-links'
test.concurrent('getLinks gives a valid ILinks class', async () => {
try {
@@ -9,6 +9,7 @@ test.concurrent('getLinks gives a valid ILinks class', async () => {
links instanceof LinuxLinks || links instanceof WindowsLinks
).toBeTruthy()
} catch (error) {
throw new Error(error)
// Other OS
}
})
+4 -4
View File
@@ -1,6 +1,6 @@
import {AbstractLinks} from '../../src/links/links'
import {LinuxLinks} from '../../src/links/linux-links'
import {SemVer} from 'semver'
import { AbstractLinks } from '../../src/links/links'
import { LinuxLinks } from '../../src/links/linux-links'
import { SemVer } from 'semver'
test.concurrent('Linux Cuda versions in descending order', async () => {
const wLinks: AbstractLinks = LinuxLinks.Instance
@@ -33,7 +33,7 @@ test.concurrent(
'Local Linux links should start with https://developer.(download.)nvidia.com and end with .run',
async () => {
const versions = LinuxLinks.Instance.getAvailableLocalCudaVersions()
const filteredVersions = versions.filter(version => {
const filteredVersions = versions.filter((version) => {
return (
version.version !== '10.0.130' &&
version.version !== '9.2.148' &&
+5 -5
View File
@@ -1,6 +1,6 @@
import {AbstractLinks} from '../../src/links/links'
import {SemVer} from 'semver'
import {WindowsLinks} from '../../src/links/windows-links'
import { AbstractLinks } from '../../src/links/links'
import { SemVer } from 'semver'
import { WindowsLinks } from '../../src/links/windows-links'
test.concurrent('Windows Cuda versions in descending order', async () => {
const wLinks: AbstractLinks = WindowsLinks.Instance
@@ -66,7 +66,7 @@ test.concurrent(
'Local Windows links should start with https://developer.(.download.)nvidia.com and end with .exe',
async () => {
const versions = WindowsLinks.Instance.getAvailableLocalCudaVersions()
const filteredVersions = versions.filter(version => {
const filteredVersions = versions.filter((version) => {
return (
version.version !== '10.0.130' &&
version.version !== '9.2.148' &&
@@ -87,7 +87,7 @@ test.concurrent(
'Network Windows links should start with https://developer.(download.)nvidia.com and end with network.exe',
async () => {
const versions = WindowsLinks.Instance.getAvailableNetworkCudaVersions()
const filteredVersions = versions.filter(version => {
const filteredVersions = versions.filter((version) => {
return (
version.version !== '10.0.130' &&
version.version !== '9.2.148' &&
+3 -3
View File
@@ -1,8 +1,8 @@
import {parseMethod} from '../src/method'
import { parseMethod } from '../src/method'
test.concurrent.each(['local', 'network'])(
'Parse %s method',
async methodString => {
async (methodString) => {
const parsed = parseMethod(methodString)
expect(parsed).toBe(methodString)
}
@@ -10,7 +10,7 @@ test.concurrent.each(['local', 'network'])(
test.concurrent('Parse invalid method', async () => {
const invalidMethod = 'invalidMethodString'
expect(() => parseMethod(invalidMethod)).toThrowError(
expect(() => parseMethod(invalidMethod)).toThrow(
`Invalid method string: ${invalidMethod}`
)
})
+3 -2
View File
@@ -1,4 +1,4 @@
import {OSType, getOs, getRelease} from '../src/platform'
import { OSType, getOs, getRelease } from '../src/platform'
import os from 'os'
test.concurrent('Return either windows of linux platform', async () => {
@@ -12,7 +12,8 @@ test.concurrent('Return either windows of linux platform', async () => {
expected = OSType.linux
break
default:
expect(getOs()).rejects.toThrow(`Unsupported OS: ${osString}`)
// eslint-disable-next-line jest/no-conditional-expect
await expect(getOs()).rejects.toThrow(`Unsupported OS: ${osString}`)
return
}
const osPlatform = await getOs()
+9 -7
View File
@@ -1,16 +1,17 @@
import {Method} from '../src/method'
import {SemVer} from 'semver'
import {getVersion} from '../src/version'
import { Method } from '../src/method'
import { SemVer } from 'semver'
import { getVersion } from '../src/version'
test.concurrent.each<Method>(['local', 'network'])(
'Successfully parse correct version for method %s',
async method => {
async (method) => {
const versionString = '11.2.2'
try {
const version = await getVersion(versionString, method)
expect(version).toBeInstanceOf(SemVer)
expect(version.compare(new SemVer(versionString))).toBe(0)
} catch (error) {
throw new Error(error)
// Other OS
}
}
@@ -18,7 +19,7 @@ test.concurrent.each<Method>(['local', 'network'])(
test.concurrent.each<Method>(['local', 'network'])(
'Expect error to be thrown on invalid version string for method %s',
async method => {
async (method) => {
const versionString =
'invalid version string that does not conform to semver'
await expect(getVersion(versionString, method)).rejects.toThrow(
@@ -29,13 +30,14 @@ test.concurrent.each<Method>(['local', 'network'])(
test.concurrent.each<Method>(['local', 'network'])(
'Expect error to be thrown on unavailable version for method %s',
async method => {
async (method) => {
const versionString = '0.0.1'
try {
await expect(getVersion(versionString, method)).rejects.toThrowError(
await expect(getVersion(versionString, method)).rejects.toThrow(
`Version not available: ${versionString}`
)
} catch (error) {
throw new Error(error)
// Other OS
}
}
+31 -6
View File
@@ -7,33 +7,58 @@ inputs:
required: false
default: '12.9.0'
sub-packages:
description: 'Only installs specified subpackages, must be in the form of a JSON array. For example, if you only want to install nvcc and visual studio integration: ["nvcc", "visual_studio_integration"] double quotes required! Note that if you want to use this on Linux, ''network'' method MUST be used.'
description:
'Only installs specified subpackages, must be in the form of a JSON array.
For example, if you only want to install nvcc and visual studio
integration: ["nvcc", "visual_studio_integration"] double quotes required!
Note that if you want to use this on Linux, ''network'' method MUST be
used.'
required: false
default: '[]'
non-cuda-sub-packages:
description: 'Only installs specified subpackages that do not have the cuda prefix, must be in the form of a JSON array. For example, if you only want to install libcublas and libcufft: ["libcublas", "libcufft"] double quotes required! Note that this only works with ''network'' method on only on Linux.'
description:
'Only installs specified subpackages that do not have the cuda prefix,
must be in the form of a JSON array. For example, if you only want to
install libcublas and libcufft: ["libcublas", "libcufft"] double quotes
required! Note that this only works with ''network'' method on only on
Linux.'
required: false
default: '[]'
method:
description: "Installation method, can be either 'local' or 'network'. 'local' downloads the entire installer with all packages and runs that (you can still only install certain packages with sub-packages on Windows). 'network' downloads a smaller executable which only downloads necessary packages which you can define in subPackages"
description:
"Installation method, can be either 'local' or 'network'. 'local'
downloads the entire installer with all packages and runs that (you can
still only install certain packages with sub-packages on Windows).
'network' downloads a smaller executable which only downloads necessary
packages which you can define in subPackages"
required: false
default: 'local'
linux-local-args:
description: '(Linux and ''local'' method only) override arguments for the linux .run installer. For example if you don''t want samples use ["--toolkit"] double quotes required!'
description:
'(Linux and ''local'' method only) override arguments for the linux .run
installer. For example if you don''t want samples use ["--toolkit"] double
quotes required!'
required: false
default: '["--toolkit", "--samples"]'
use-github-cache:
description: 'Use GitHub cache to cache downloaded installer on GitHub servers'
description:
'Use GitHub cache to cache downloaded installer on GitHub servers'
required: false
default: 'true'
use-local-cache:
description: 'Use local cache to cache downloaded installer on the local runner'
description:
'Use local cache to cache downloaded installer on the local runner'
required: false
default: 'true'
log-file-suffix:
description: 'Suffix of log file name in artifact'
required: false
default: 'log.txt'
outputs:
CUDA_PATH:
description: 'Path to CUDA installation'
cuda:
description: 'Version of CUDA installed'
runs:
using: 'node20'
main: dist/index.js
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="106" height="20" role="img" aria-label="Coverage: 100%"><title>Coverage: 100%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="106" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="43" height="20" fill="#4c1"/><rect width="106" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="835" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">100%</text><text x="835" y="140" transform="scale(.1)" fill="#fff" textLength="330">100%</text></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

Generated Vendored
+199290 -132376
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1
View File
File diff suppressed because one or more lines are too long
+81
View File
@@ -0,0 +1,81 @@
// See: https://eslint.org/docs/latest/use/configure/configuration-files
import { fixupPluginRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import _import from 'eslint-plugin-import'
import jest from 'eslint-plugin-jest'
import prettier from 'eslint-plugin-prettier'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
})
export default [
{
ignores: ['**/coverage', '**/dist', '**/linter', '**/node_modules']
},
...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'plugin:prettier/recommended'
),
{
plugins: {
import: fixupPluginRules(_import),
jest,
prettier,
'@typescript-eslint': typescriptEslint
},
languageOptions: {
globals: {
...globals.node,
...globals.jest,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parser: tsParser,
ecmaVersion: 2023,
sourceType: 'module',
parserOptions: {
project: ['tsconfig.eslint.json'],
tsconfigRootDir: '.'
}
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: 'tsconfig.eslint.json'
}
}
},
rules: {
camelcase: 'off',
'eslint-comments/no-use': 'off',
'eslint-comments/no-unused-disable': 'off',
'i18n-text/no-en': 'off',
'import/no-namespace': 'off',
'no-console': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
'prettier/prettier': 'error'
}
}
]
+33 -4
View File
@@ -1,11 +1,40 @@
module.exports = {
// See: https://jestjs.io/docs/configuration
/** @type {import('ts-jest').JestConfigWithTsJest} **/
export default {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
collectCoverage: true,
collectCoverageFrom: ['./src/**'],
coverageDirectory: './coverage',
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
coverageReporters: ['json-summary', 'text', 'lcov'],
// Uncomment the below lines if you would like to enforce a coverage threshold
// for your action. This will fail the build if the coverage is below the
// specified thresholds.
// coverageThreshold: {
// global: {
// branches: 100,
// functions: 100,
// lines: 100,
// statements: 100
// }
// },
extensionsToTreatAsEsm: ['.ts'],
moduleFileExtensions: ['ts', 'js'],
preset: 'ts-jest',
reporters: ['default'],
resolver: 'ts-jest-resolver',
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
transform: {
'^.+\\.ts$': 'ts-jest'
'^.+\\.ts$': [
'ts-jest',
{
tsconfig: 'tsconfig.eslint.json',
useESM: true
}
]
},
verbose: true
}
+5804 -3027
View File
File diff suppressed because it is too large Load Diff
+65 -38
View File
@@ -1,58 +1,85 @@
{
"name": "cuda-toolkit",
"version": "0.2.24",
"description": "GitHub Action to install the NVIDIA CUDA Toolkit",
"main": "lib/main.js",
"scripts": {
"build": "tsc --newLine lf",
"format": "prettier --write **/*.ts jest.config.js",
"format-check": "prettier --check **/*.ts jest.config.js",
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
"package": "ncc build",
"test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
},
"version": "0.2.24",
"author": "Jim Verheijde",
"type": "module",
"private": true,
"homepage": "https://github.com/Jimver/cuda-toolkit",
"repository": {
"type": "git",
"url": "git+https://github.com/Jimver/cuda-toolkit.git"
},
"keywords": [],
"author": "Jim Verheijde",
"bugs": {
"url": "https://github.com/Jimver/cuda-toolkit/issues"
},
"homepage": "https://github.com/Jimver/cuda-toolkit#readme",
"volta": {
"node": "20.12.2"
"keywords": [
"actions",
"cuda",
"cuda-toolkit",
"github-actions",
"nvidia",
"toolkit"
],
"exports": {
".": "./dist/index.js"
},
"engines": {
"node": ">=20"
},
"scripts": {
"bundle": "npm run format:write && npm run package",
"ci-test": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 npx jest",
"coverage": "npx make-coverage-badge --output-path ./badges/coverage.svg",
"format:write": "npx prettier --write .",
"format:check": "npx prettier --check .",
"lint": "npx eslint .",
"local-action": "npx @github/local-action . src/main.ts .env",
"package": "npx rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
"package:watch": "npm run package -- --watch",
"test": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 npx jest",
"all": "npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"
},
"license": "MIT",
"dependencies": {
"@actions/artifact": "^2.1.5",
"@actions/cache": "^3.2.4",
"@actions/core": "^1.10.1",
"@actions/artifact": "^2.3.2",
"@actions/cache": "^4.0.3",
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/glob": "^0.4.0",
"@actions/glob": "^0.5.0",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1",
"@types/semver": "^7.5.8",
"semver": "^7.6.0"
"@actions/tool-cache": "^2.0.2",
"@types/semver": "^7.7.0",
"semver": "^7.7.2"
},
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/node": "^20.12.7",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-github": "^4.10.1",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-prettier": "^5.1.3",
"@eslint/compat": "^1.2.9",
"@github/local-action": "^3.2.1",
"@jest/globals": "^29.7.0",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-typescript": "^12.1.1",
"@rollup/plugin-json": "^6.1.0",
"@types/jest": "^29.5.14",
"@types/node": "^20.17.48",
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"eslint": "^9.27.0",
"eslint-config-prettier": "^10.1.5",
"eslint-import-resolver-typescript": "^4.3.5",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-prettier": "^5.4.0",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"js-yaml": "^4.1.0",
"prettier": "3.2.5",
"ts-jest": "^29.1.1",
"typescript": "^5.3.3"
"make-coverage-badge": "^1.2.0",
"prettier": "^3.5.3",
"prettier-eslint": "^16.4.2",
"rollup": "^4.41.0",
"ts-jest": "^29.3.4",
"ts-jest-resolver": "^2.0.1",
"typescript": "^5.8.3"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "*"
}
}
+24
View File
@@ -0,0 +1,24 @@
// See: https://rollupjs.org/introduction/
import commonjs from '@rollup/plugin-commonjs'
import nodeResolve from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import json from '@rollup/plugin-json'
const config = {
input: 'src/index.ts',
output: {
esModule: true,
file: 'dist/index.js',
format: 'es',
sourcemap: true
},
plugins: [
typescript(),
nodeResolve({ preferBuiltins: true }),
commonjs(),
json()
]
}
export default config
+9 -8
View File
@@ -1,10 +1,10 @@
import * as core from '@actions/core'
import {OSType, getOs} from './platform'
import {Method} from './method'
import {SemVer} from 'semver'
import {exec} from '@actions/exec'
import {execReturnOutput} from './run-command'
import {CPUArch, getArch} from './arch'
import { OSType, getOs } from './platform.js'
import { Method } from './method.js'
import { SemVer } from 'semver'
import { exec } from '@actions/exec'
import { execReturnOutput } from './run-command.js'
import { CPUArch, getArch } from './arch.js'
export async function useApt(method: Method): Promise<boolean> {
return method === 'network' && (await getOs()) === OSType.linux
@@ -28,6 +28,7 @@ export async function aptSetup(version: SemVer): Promise<void> {
arch = 'sbsa' // This might not work in the future, they are merging arm64 and sbsa
}
} catch (error) {
core.debug(`Error detecting architecture: ${error}`)
core.warning(`Could not detect architecture, using default ${arch}`)
}
core.debug(
@@ -77,12 +78,12 @@ export async function aptInstall(
} else {
// Only install specified packages
const prefixedSubPackages = subPackages.map(
subPackage => `cuda-${subPackage}`
(subPackage) => `cuda-${subPackage}`
)
const versionedSubPackages = prefixedSubPackages
.concat(nonCudaSubPackages)
.map(
nonCudaSubPackage =>
(nonCudaSubPackage) =>
`${nonCudaSubPackage}-${version.major}-${version.minor}`
)
core.debug(`Only install subpackages: ${versionedSubPackages}`)
+1 -1
View File
@@ -1,4 +1,4 @@
import {debug} from '@actions/core'
import { debug } from '@actions/core'
import os from 'os'
export enum CPUArch {
+7 -7
View File
@@ -3,14 +3,14 @@ import * as core from '@actions/core'
import * as glob from '@actions/glob'
import * as tc from '@actions/tool-cache'
import * as io from '@actions/io'
import {OSType, getOs, getRelease} from './platform'
import {AbstractLinks} from './links/links'
import {Method} from './method'
import {SemVer} from 'semver'
import {WindowsLinks} from './links/windows-links'
import { OSType, getOs, getRelease } from './platform.js'
import { AbstractLinks } from './links/links.js'
import { Method } from './method.js'
import { SemVer } from 'semver'
import { WindowsLinks } from './links/windows-links.js'
import fs from 'fs'
import {getLinks} from './links/get-links'
import {getArch} from './arch'
import { getLinks } from './links/get-links.js'
import { getArch } from './arch.js'
// Download helper which returns the installer executable and caches it for next runs
export async function download(
+9 -8
View File
@@ -1,12 +1,12 @@
import * as core from '@actions/core'
import {Method, parseMethod} from './method'
import {OSType, getOs} from './platform'
import {aptInstall, aptSetup, useApt} from './apt-installer'
import {download} from './downloader'
import {getVersion} from './version'
import {install} from './installer'
import {updatePath} from './update-path'
import {parsePackages} from './parser'
import { Method, parseMethod } from './method.js'
import { OSType, getOs } from './platform.js'
import { aptInstall, aptSetup, useApt } from './apt-installer.js'
import { download } from './downloader.js'
import { getVersion } from './version.js'
import { install } from './installer.js'
import { updatePath } from './update-path.js'
import { parsePackages } from './parser.js'
async function run(): Promise<void> {
try {
@@ -54,6 +54,7 @@ async function run(): Promise<void> {
linuxLocalArgsArray = JSON.parse(linuxLocalArgs)
// TODO verify that elements are valid package names (--samples, --driver, --toolkit, etc.)
} catch (error) {
core.debug(`Json parsing error: ${error}`)
const errString = `Error parsing input 'linux-local-args' to a JSON string array: ${linuxLocalArgs}`
core.debug(errString)
throw new Error(errString)
+6 -5
View File
@@ -1,9 +1,9 @@
import artifact from '@actions/artifact'
import { DefaultArtifactClient } from '@actions/artifact'
import * as core from '@actions/core'
import * as glob from '@actions/glob'
import {OSType, getOs, getRelease} from './platform'
import {SemVer} from 'semver'
import {exec} from '@actions/exec'
import { OSType, getOs, getRelease } from './platform.js'
import { SemVer } from 'semver'
import { exec } from '@actions/exec'
import * as os from 'os'
export async function install(
@@ -51,7 +51,7 @@ export async function install(
installArgs = ['-s']
// Add subpackages to command args (if any)
installArgs = installArgs.concat(
subPackages.map(subPackage => {
subPackages.map((subPackage) => {
// Display driver sub package name is not dependent on version
if (subPackage === 'Display.Driver') {
return subPackage
@@ -88,6 +88,7 @@ export async function install(
await exec(`sudo chown ${username} ${file}`)
}
const rootDirectory = '/var/log'
const artifact = new DefaultArtifactClient()
const uploadResult = await artifact.uploadArtifact(
artifactName,
files,
+4 -4
View File
@@ -1,7 +1,7 @@
import {OSType, getOs} from '../platform'
import {AbstractLinks} from './links'
import {LinuxLinks} from './linux-links'
import {WindowsLinks} from './windows-links'
import { OSType, getOs } from '../platform.js'
import { AbstractLinks } from './links.js'
import { LinuxLinks } from './linux-links.js'
import { WindowsLinks } from './windows-links.js'
// Platform independent getter for ILinks interface
export async function getLinks(): Promise<AbstractLinks> {
+2 -2
View File
@@ -1,11 +1,11 @@
import {SemVer} from 'semver'
import { SemVer } from 'semver'
// Interface for getting cuda versions and corresponding download URLs
export abstract class AbstractLinks {
protected cudaVersionToURL: Map<string, string> = new Map()
getAvailableLocalCudaVersions(): SemVer[] {
return Array.from(this.cudaVersionToURL.keys()).map(s => new SemVer(s))
return Array.from(this.cudaVersionToURL.keys()).map((s) => new SemVer(s))
}
async getLocalURLFromCudaVersion(version: SemVer): Promise<URL> {
+3 -3
View File
@@ -1,6 +1,6 @@
import {SemVer} from 'semver'
import {AbstractLinks} from './links'
import {CPUArch, getArch} from '../arch'
import { SemVer } from 'semver'
import { AbstractLinks } from './links.js'
import { CPUArch, getArch } from '../arch.js'
/**
* Singleton class for windows links.
+3 -3
View File
@@ -1,5 +1,5 @@
import {AbstractLinks} from './links'
import {SemVer} from 'semver'
import { AbstractLinks } from './links.js'
import { SemVer } from 'semver'
// # Dictionary of known cuda versions and thier download URLS, which do not follow a consistent pattern :(
// $CUDA_KNOWN_URLS = @{
@@ -432,7 +432,7 @@ export class WindowsLinks extends AbstractLinks {
getAvailableNetworkCudaVersions(): SemVer[] {
return Array.from(this.cudaVersionToNetworkUrl.keys()).map(
s => new SemVer(s)
(s) => new SemVer(s)
)
}
+1
View File
@@ -8,6 +8,7 @@ export async function parsePackages(
try {
subPackagesArray = JSON.parse(subPackages)
} catch (error) {
core.debug(`Json parsing error: ${error}`)
const errString = `Error parsing input '${parameterName}' to a JSON string array: ${subPackages}`
core.debug(errString)
throw new Error(errString)
+1 -1
View File
@@ -1,4 +1,4 @@
import {debug} from '@actions/core'
import { debug } from '@actions/core'
import os from 'os'
export enum OSType {
+1 -1
View File
@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import {exec} from '@actions/exec'
import { exec } from '@actions/exec'
export async function execReturnOutput(
command: string,
+2 -2
View File
@@ -1,7 +1,7 @@
import * as core from '@actions/core'
import * as path from 'path'
import {OSType, getOs} from './platform'
import {SemVer} from 'semver'
import { OSType, getOs } from './platform.js'
import { SemVer } from 'semver'
export async function updatePath(version: SemVer): Promise<string> {
let cudaPath: string
+10 -8
View File
@@ -1,10 +1,10 @@
import * as core from '@actions/core'
import {OSType, getOs} from './platform'
import {AbstractLinks} from './links/links'
import {Method} from './method'
import {SemVer} from 'semver'
import {WindowsLinks} from './links/windows-links'
import {getLinks} from './links/get-links'
import { OSType, getOs } from './platform.js'
import { AbstractLinks } from './links/links.js'
import { Method } from './method.js'
import { SemVer } from 'semver'
import { WindowsLinks } from './links/windows-links.js'
import { getLinks } from './links/get-links.js'
// Helper for converting string to SemVer and verifying it exists in the links
export async function getVersion(
@@ -25,12 +25,14 @@ export async function getVersion(
versions = links.getAvailableLocalCudaVersions()
break
case OSType.windows:
versions = (links as WindowsLinks).getAvailableNetworkCudaVersions()
versions = (
links as unknown as WindowsLinks
).getAvailableNetworkCudaVersions()
break
}
}
core.debug(`Available versions: ${versions}`)
if (versions.find(v => v.compare(version) === 0) !== undefined) {
if (versions.find((v) => v.compare(version) === 0) !== undefined) {
core.debug(`Version available: ${version}`)
return version
} else {
+22
View File
@@ -0,0 +1,22 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"declarationMap": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["ES2022"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"newLine": "lf",
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"pretty": true,
"resolveJsonModule": true,
"strict": true,
"strictNullChecks": true,
"target": "ES2022"
}
}
+15 -2
View File
@@ -1,4 +1,17 @@
{
"extends": "./tsconfig.json",
"include": ["./src/**/*.ts", "__tests__/**/*.test.ts"]
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"noEmit": true
},
"exclude": ["dist", "node_modules"],
"include": [
"__fixtures__",
"__tests__",
"src",
"eslint.config.mjs",
"jest.config.js",
"rollup.config.ts"
]
}
+7 -10
View File
@@ -1,14 +1,11 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "./dist"
},
"include": [
"./src/**/*.ts"
],
"exclude": ["node_modules"]
"exclude": ["__fixtures__", "__tests__", "coverage", "dist", "node_modules"],
"include": ["src"]
}