mirror of https://github.com/aminya/setup-cpp
Merge branch 'master' into pr/135
This commit is contained in:
commit
f7e3122b1e
|
@ -6,6 +6,8 @@ on:
|
||||||
- master
|
- master
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Test:
|
Test:
|
||||||
|
@ -23,7 +25,7 @@ jobs:
|
||||||
- macos-12
|
- macos-12
|
||||||
- macos-11
|
- macos-11
|
||||||
node:
|
node:
|
||||||
- 14 # installed on the images
|
- 16
|
||||||
pnpm:
|
pnpm:
|
||||||
- 7
|
- 7
|
||||||
cache_reset_counter:
|
cache_reset_counter:
|
||||||
|
@ -57,21 +59,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
pnpm install
|
pnpm install
|
||||||
|
|
||||||
# Create self-contained executable that bundles Nodejs
|
|
||||||
- name: Create Executable
|
|
||||||
if: "contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-20.04') || contains(matrix.os, 'macos-11')"
|
|
||||||
run: |
|
|
||||||
pnpm run pack.exe
|
|
||||||
|
|
||||||
- name: Upload Executable
|
|
||||||
if: "contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-20.04') || contains(matrix.os, 'macos-11')"
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
./exe
|
|
||||||
./dist
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
# - name: Setup SSH debugging session
|
# - name: Setup SSH debugging session
|
||||||
# uses: mxschmitt/action-tmate@v3
|
# uses: mxschmitt/action-tmate@v3
|
||||||
|
|
||||||
|
@ -81,6 +68,49 @@ jobs:
|
||||||
pnpm run test
|
pnpm run test
|
||||||
continue-on-error: ${{ contains(matrix.os, 'ubuntu-18.04') }}
|
continue-on-error: ${{ contains(matrix.os, 'ubuntu-18.04') }}
|
||||||
|
|
||||||
|
# Create self-contained executable that bundles Nodejs
|
||||||
|
- name: Create Executable
|
||||||
|
if: "contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12')"
|
||||||
|
run: |
|
||||||
|
pnpm run pack.exe
|
||||||
|
|
||||||
|
- name: Upload Artifacts
|
||||||
|
if: ${{ (startsWith(github.ref, 'refs/tags/')) && contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
./exe
|
||||||
|
./dist
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
Release:
|
||||||
|
needs: Test
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Download Artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- name: Place Artifacts
|
||||||
|
run: |
|
||||||
|
mv -v artifact/* ./
|
||||||
|
chmod +x -R ./exe/
|
||||||
|
|
||||||
|
- name: Draft the release
|
||||||
|
uses: meeDamian/github-release@2.0
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
gzip: folders
|
||||||
|
draft: true
|
||||||
|
files: >
|
||||||
|
./exe/setup_cpp_windows.exe
|
||||||
|
./exe/setup_cpp_linux
|
||||||
|
./exe/setup_cpp_mac
|
||||||
|
./dist/node12/setup_cpp.js
|
||||||
|
./dist/node12/setup_cpp.js.map
|
||||||
|
./dist/node12/
|
||||||
|
./dist/node16/
|
||||||
|
|
||||||
Docker:
|
Docker:
|
||||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docker]') }}
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docker]') }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
20
README.md
20
README.md
|
@ -36,13 +36,13 @@ Tip: You can automate downloading using `wget`, `curl`, or other similar tools.
|
||||||
|
|
||||||
#### Executable
|
#### Executable
|
||||||
|
|
||||||
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.20.1), and run it with the available options.
|
Download the executable for your platform from [here](https://github.com/aminya/setup-cpp/releases/tag/v0.21.0), and run it with the available options.
|
||||||
|
|
||||||
An example that installs llvm, cmake, ninja, ccache, and vcpkg:
|
An example that installs llvm, cmake, ninja, ccache, and vcpkg:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
# windows example (open shell as admin)
|
# windows example (open shell as admin)
|
||||||
curl.exe -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp_windows.exe"
|
curl.exe -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp_windows.exe"
|
||||||
.\setup_cpp_windows --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
.\setup_cpp_windows --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||||
|
|
||||||
RefreshEnv.cmd # activate cpp environment variables
|
RefreshEnv.cmd # activate cpp environment variables
|
||||||
|
@ -50,7 +50,7 @@ RefreshEnv.cmd # activate cpp environment variables
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
# linux example
|
# linux example
|
||||||
wget "https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp_linux"
|
wget "https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp_linux"
|
||||||
chmod +x setup_cpp_linux
|
chmod +x setup_cpp_linux
|
||||||
sudo ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
sudo ./setup_cpp_linux --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ source ~/.cpprc # activate cpp environment variables
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
# mac example
|
# mac example
|
||||||
wget "https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp_mac"
|
wget "https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp_mac"
|
||||||
chmod +x setup_cpp_mac
|
chmod +x setup_cpp_mac
|
||||||
sudo ./setup_cpp_mac --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
sudo ./setup_cpp_mac --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ NOTE: On Unix systems, you will not need `sudo` if you are already a root user (
|
||||||
|
|
||||||
#### With Nodejs
|
#### With Nodejs
|
||||||
|
|
||||||
Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp.js), and run it with the available options.
|
Download the `setup_cpp.js` file form [here](https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp.js), and run it with the available options.
|
||||||
|
|
||||||
On Windows:
|
On Windows:
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ Open the shell as admin, download via `curl`, then install
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
# open shell as admin
|
# open shell as admin
|
||||||
curl.exe -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp.js"
|
curl.exe -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp.js"
|
||||||
node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||||
|
|
||||||
RefreshEnv.cmd # activate cpp environment variables
|
RefreshEnv.cmd # activate cpp environment variables
|
||||||
|
@ -91,7 +91,7 @@ RefreshEnv.cmd # activate cpp environment variables
|
||||||
On Linux or Mac:
|
On Linux or Mac:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
wget "https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp.js"
|
wget "https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp.js"
|
||||||
sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
sudo node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||||
|
|
||||||
source ~/.cpprc # activate cpp environment variables
|
source ~/.cpprc # activate cpp environment variables
|
||||||
|
@ -170,7 +170,7 @@ FROM ubuntu:22.04 AS base
|
||||||
WORKDIR "/"
|
WORKDIR "/"
|
||||||
RUN apt-get update -qq
|
RUN apt-get update -qq
|
||||||
RUN apt-get install -y --no-install-recommends wget
|
RUN apt-get install -y --no-install-recommends wget
|
||||||
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp_linux"
|
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp_linux"
|
||||||
RUN chmod +x ./setup_cpp_linux
|
RUN chmod +x ./setup_cpp_linux
|
||||||
|
|
||||||
# install llvm, cmake, ninja, and ccache
|
# install llvm, cmake, ninja, and ccache
|
||||||
|
@ -262,7 +262,7 @@ stages:
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E9377A2BA9EF27F
|
||||||
|
|
||||||
.setup_cpp: &setup_cpp |
|
.setup_cpp: &setup_cpp |
|
||||||
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp_linux"
|
curl -LJO "https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp_linux"
|
||||||
chmod +x setup_cpp_linux
|
chmod +x setup_cpp_linux
|
||||||
./setup_cpp_linux --compiler $compiler --cmake true --ninja true --ccache true --vcpkg true
|
./setup_cpp_linux --compiler $compiler --cmake true --ninja true --ccache true --vcpkg true
|
||||||
source ~/.cpprc
|
source ~/.cpprc
|
||||||
|
@ -297,7 +297,7 @@ test_linux_gcc:
|
||||||
## Usage Examples
|
## Usage Examples
|
||||||
|
|
||||||
- [cpp_vcpkg_project project](https://github.com/aminya/cpp_vcpkg_project)
|
- [cpp_vcpkg_project project](https://github.com/aminya/cpp_vcpkg_project)
|
||||||
- [project_optins](https://github.com/aminya/project_options)
|
- [project_options](https://github.com/aminya/project_options)
|
||||||
- [cpp-best-practices starter project](https://github.com/cpp-best-practices/cpp_starter_project)
|
- [cpp-best-practices starter project](https://github.com/cpp-best-practices/cpp_starter_project)
|
||||||
- [ftxui](https://github.com/ArthurSonzogni/FTXUI)
|
- [ftxui](https://github.com/ArthurSonzogni/FTXUI)
|
||||||
- [inja](https://github.com/pantor/inja)
|
- [inja](https://github.com/pantor/inja)
|
||||||
|
|
|
@ -80,8 +80,8 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "node12"
|
using: "node16"
|
||||||
main: "dist/setup_cpp.js"
|
main: "dist/node16/setup_cpp.js"
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: "award"
|
icon: "award"
|
||||||
|
|
|
@ -11,7 +11,7 @@ RUN pacman -S --noconfirm --needed nodejs
|
||||||
RUN pacman -S --noconfirm --needed curl
|
RUN pacman -S --noconfirm --needed curl
|
||||||
|
|
||||||
# add setup_cpp.js
|
# add setup_cpp.js
|
||||||
COPY "./dist/" "/"
|
COPY "./dist/node12" "/"
|
||||||
WORKDIR "/"
|
WORKDIR "/"
|
||||||
|
|
||||||
# run installation
|
# run installation
|
||||||
|
|
|
@ -8,7 +8,7 @@ RUN dnf -y install nodejs
|
||||||
RUN dnf -y install curl
|
RUN dnf -y install curl
|
||||||
|
|
||||||
# add setup_cpp.js
|
# add setup_cpp.js
|
||||||
COPY "./dist/" "/"
|
COPY "./dist/node12" "/"
|
||||||
WORKDIR "/"
|
WORKDIR "/"
|
||||||
|
|
||||||
# run installation
|
# run installation
|
||||||
|
|
|
@ -5,7 +5,7 @@ FROM ubuntu:22.04 AS base
|
||||||
WORKDIR "/"
|
WORKDIR "/"
|
||||||
RUN apt-get update -qq
|
RUN apt-get update -qq
|
||||||
RUN apt-get install -y --no-install-recommends wget
|
RUN apt-get install -y --no-install-recommends wget
|
||||||
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.20.1/setup_cpp_linux"
|
RUN wget --no-verbose "https://github.com/aminya/setup-cpp/releases/download/v0.21.0/setup_cpp_linux"
|
||||||
RUN chmod +x ./setup_cpp_linux
|
RUN chmod +x ./setup_cpp_linux
|
||||||
|
|
||||||
# install llvm, cmake, ninja, and ccache
|
# install llvm, cmake, ninja, and ccache
|
||||||
|
|
|
@ -12,7 +12,7 @@ RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
|
||||||
RUN apt-get install -y --no-install-recommends nodejs
|
RUN apt-get install -y --no-install-recommends nodejs
|
||||||
|
|
||||||
# add setup_cpp.js
|
# add setup_cpp.js
|
||||||
ADD "./dist/" "/"
|
COPY "./dist/node12" "/"
|
||||||
WORKDIR "/"
|
WORKDIR "/"
|
||||||
|
|
||||||
# run installation
|
# run installation
|
||||||
|
|
|
@ -4,7 +4,7 @@ RUN apt-get update -qq
|
||||||
RUN apt-get install -y --no-install-recommends nodejs
|
RUN apt-get install -y --no-install-recommends nodejs
|
||||||
|
|
||||||
# add setup_cpp.js
|
# add setup_cpp.js
|
||||||
COPY "./dist/" "/"
|
COPY "./dist/node12" "/"
|
||||||
WORKDIR "/"
|
WORKDIR "/"
|
||||||
|
|
||||||
# run installation
|
# run installation
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { exec } = require("@actions/exec")
|
import { node } from "execa"
|
||||||
|
|
||||||
function getPlatformName() {
|
function getPlatformName() {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
|
@ -26,13 +26,19 @@ function main() {
|
||||||
|
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
exes.map((exe) =>
|
exes.map((exe) =>
|
||||||
exec(
|
node("./node_modules/caxa/build/index.mjs", [
|
||||||
`./node_modules/.bin/caxa --input ./dist --output ./exe/setup_cpp_${getPlatformName()}${exe} -- "{{caxa}}/node_modules/.bin/node${exe}" "{{caxa}}/setup_cpp.js"`
|
"--input",
|
||||||
)
|
"./dist/node16",
|
||||||
|
"--output",
|
||||||
|
`./exe/setup_cpp_${getPlatformName()}${exe}`,
|
||||||
|
"--",
|
||||||
|
`{{caxa}}/node_modules/.bin/node${exe}`,
|
||||||
|
`{{caxa}}/setup_cpp.js`,
|
||||||
|
])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
main().then((exit) => {
|
main().catch((err) => {
|
||||||
process.exit(exit)
|
throw err
|
||||||
})
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "gcc",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"severity": 4,
|
||||||
|
"message": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "llvm",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"severity": 4,
|
||||||
|
"message": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "msvc",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^(?:\\s+\\d+>)?(\\S.*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"column": 3,
|
||||||
|
"severity": 4,
|
||||||
|
"code": 5,
|
||||||
|
"message": 6
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "python",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$",
|
||||||
|
"message": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
||||||
["TS6133"]
|
|
|
@ -1 +0,0 @@
|
||||||
["node_modules/setup-python/src/cache-distributions/poetry-cache.ts"]
|
|
60
package.json
60
package.json
|
@ -1,22 +1,22 @@
|
||||||
{
|
{
|
||||||
"name": "setup-cpp",
|
"name": "setup-cpp",
|
||||||
"version": "0.20.1",
|
"version": "0.21.0",
|
||||||
"description": "Install all the tools required for building and testing C++/C projects.",
|
"description": "Install all the tools required for building and testing C++/C projects.",
|
||||||
"repository": "https://github.com/aminya/setup-cpp",
|
"repository": "https://github.com/aminya/setup-cpp",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"author": "Amin Yahyaabadi",
|
"author": "Amin Yahyaabadi",
|
||||||
"exports": {
|
"exports": {
|
||||||
"import": "./dist/setup-cpp.mjs",
|
"import": "./dist/node12/setup-cpp.mjs",
|
||||||
"require": "./dist/setup-cpp.js"
|
"require": "./dist/node12/setup-cpp.js"
|
||||||
},
|
},
|
||||||
"main": "./dist/setup_cpp.js",
|
"main": "./dist/node12/setup_cpp.js",
|
||||||
"source": "./src/main.ts",
|
"source": "./src/main.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"setup-cpp": "./dist/setup_cpp.js",
|
"setup-cpp": "./dist/node12/setup_cpp.js",
|
||||||
"setup_cpp": "./dist/setup_cpp.js"
|
"setup_cpp": "./dist/node12/setup_cpp.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "shx rm -rf dist/ && shx mkdir ./dist && run-p lint.tsc build.parcel copy.matchers",
|
"build": "shx rm -rf dist/ && shx mkdir -p ./dist/node12 ./dist/node16 && run-p lint.tsc build.parcel copy.matchers",
|
||||||
"build.docker": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp .",
|
"build.docker": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup_cpp .",
|
||||||
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup_cpp:arch .",
|
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup_cpp:arch .",
|
||||||
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup_cpp:fedora .",
|
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup_cpp:fedora .",
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
"build.parcel": "cross-env NODE_ENV=production parcel build --detailed-report",
|
"build.parcel": "cross-env NODE_ENV=production parcel build --detailed-report",
|
||||||
"bump": "ncu -u -x execa,numerous && pnpm update",
|
"bump": "ncu -u -x execa,numerous && pnpm update",
|
||||||
"clean": "shx rm -rf .parcel-cache dist exe",
|
"clean": "shx rm -rf .parcel-cache dist exe",
|
||||||
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/ && shx cp ./src/msvc/msvc_matcher.json ./dist && shx cp ./src/python/python_matcher.json ./dist/ && shx cp ./src/llvm/llvm_matcher.json ./dist/ ",
|
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/node12/ && shx cp ./src/msvc/msvc_matcher.json ./dist/node12/ && shx cp ./src/python/python_matcher.json ./dist/node12/ && shx cp ./src/llvm/llvm_matcher.json ./dist/node12/ && shx cp ./dist/node12/*.json ./dist/node16/",
|
||||||
"dev": "cross-env NODE_ENV=development parcel watch",
|
"dev": "cross-env NODE_ENV=development parcel watch",
|
||||||
"docs": "shx rm -rf packages/*/README.md && pnpm -r exec readme --path ../../dev/readme/template.md -y && pnpm -r exec ts-readme",
|
"docs": "shx rm -rf packages/*/README.md && pnpm -r exec readme --path ../../dev/readme/template.md -y && pnpm -r exec ts-readme",
|
||||||
"format": "run-s lint.prettier",
|
"format": "run-s lint.prettier",
|
||||||
|
@ -32,8 +32,8 @@
|
||||||
"lint.cspell": "cspell lint --no-progress --show-suggestions",
|
"lint.cspell": "cspell lint --no-progress --show-suggestions",
|
||||||
"lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
"lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
|
||||||
"lint.prettier": "prettier --write .",
|
"lint.prettier": "prettier --write .",
|
||||||
"lint.tsc": "tsc --noEmit | loose-ts-check",
|
"lint.tsc": "tsc --noEmit",
|
||||||
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && node ./dev/scripts/pack-exe.js",
|
"pack.exe": "shx rm -rf ./dist/tsconfig.tsbuildinfo && ts-node --esm ./dev/scripts/pack-exe.ts",
|
||||||
"prepare": "pnpm run -r build && pnpm run -w build",
|
"prepare": "pnpm run -r build && pnpm run -w build",
|
||||||
"start.docker": "docker run -t setup_cpp .",
|
"start.docker": "docker run -t setup_cpp .",
|
||||||
"start.docker.arch": "docker run -t setup_cpp:arch .",
|
"start.docker.arch": "docker run -t setup_cpp:arch .",
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
},
|
},
|
||||||
"prettier": "prettier-config-atomic",
|
"prettier": "prettier-config-atomic",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.9.1",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2",
|
"@actions/io": "^1.1.2",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
|
@ -65,8 +65,8 @@
|
||||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||||
"numerous": "1.0.3",
|
"numerous": "1.0.3",
|
||||||
"patha": "^0.4.1",
|
"patha": "^0.4.1",
|
||||||
"semver": "7.3.7",
|
"semver": "7.3.8",
|
||||||
"setup-python": "github:actions/setup-python#c474c82340438924daab9282d07300bfe7e3692d",
|
"setup-python": "github:actions/setup-python#v4.3.0",
|
||||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||||
"ubuntu-version": "^2.0.0",
|
"ubuntu-version": "^2.0.0",
|
||||||
"untildify-user": "workspace:1.0.0",
|
"untildify-user": "workspace:1.0.0",
|
||||||
|
@ -75,21 +75,20 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/cross-spawn": "^6.0.2",
|
"@types/cross-spawn": "^6.0.2",
|
||||||
"@types/jest": "^29.0.3",
|
"@types/jest": "^29.2.0",
|
||||||
"@types/mri": "^1.1.1",
|
"@types/mri": "^1.1.1",
|
||||||
"@types/node": "^18.7.18",
|
"@types/node": "^18.11.2",
|
||||||
"@types/semver": "^7.3.12",
|
"@types/semver": "^7.3.12",
|
||||||
"@types/which": "^2.0.1",
|
"@types/which": "^2.0.1",
|
||||||
"caxa": "^2.1.0",
|
"caxa": "^3.0.1",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"cross-spawn": "^7.0.3",
|
"cross-spawn": "^7.0.3",
|
||||||
"cspell": "^6.9.1",
|
"cspell": "^6.12.0",
|
||||||
"eslint": "^8.23.1",
|
"eslint": "^8.25.0",
|
||||||
"eslint-config-atomic": "^1.18.1",
|
"eslint-config-atomic": "^1.18.1",
|
||||||
"gen-readme": "^1.6.0",
|
"gen-readme": "^1.6.0",
|
||||||
"jest": "^29.0.3",
|
"jest": "^29.2.1",
|
||||||
"loose-ts-check": "^1.2.0",
|
"npm-check-updates": "^16.3.14",
|
||||||
"npm-check-updates": "^16.1.3",
|
|
||||||
"npm-run-all2": "^6.0.2",
|
"npm-run-all2": "^6.0.2",
|
||||||
"parcel": "2.7.0",
|
"parcel": "2.7.0",
|
||||||
"prettier": "2.7.1",
|
"prettier": "2.7.1",
|
||||||
|
@ -97,9 +96,10 @@
|
||||||
"readme-md-generator": "^1.0.0",
|
"readme-md-generator": "^1.0.0",
|
||||||
"shx": "0.3.4",
|
"shx": "0.3.4",
|
||||||
"terser-config-atomic": "^0.1.1",
|
"terser-config-atomic": "^0.1.1",
|
||||||
"ts-jest": "^29.0.1",
|
"ts-jest": "^29.0.3",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
"ts-readme": "^1.1.3",
|
"ts-readme": "^1.1.3",
|
||||||
"typescript": "^4.8.3"
|
"typescript": "^4.8.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.x"
|
"node": ">=12.x"
|
||||||
|
@ -127,10 +127,11 @@
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"patha": "patha/dist/index.node.mjs"
|
"patha": "patha/dist/index.node.mjs"
|
||||||
},
|
},
|
||||||
|
"main.actions": "./dist/node16/setup_cpp.js",
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"semver": "7.3.7",
|
"semver": "7.3.8",
|
||||||
"eslint": "^8.23.1",
|
"eslint": "^8.25.0",
|
||||||
"prettier": "2.7.1",
|
"prettier": "2.7.1",
|
||||||
"lru-cache": "7.8.1",
|
"lru-cache": "7.8.1",
|
||||||
"core-js": "*",
|
"core-js": "*",
|
||||||
|
@ -151,6 +152,15 @@
|
||||||
"includeNodeModules": true,
|
"includeNodeModules": true,
|
||||||
"optimize": true,
|
"optimize": true,
|
||||||
"outputFormat": "commonjs"
|
"outputFormat": "commonjs"
|
||||||
|
},
|
||||||
|
"main.actions": {
|
||||||
|
"context": "node",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.x"
|
||||||
|
},
|
||||||
|
"includeNodeModules": true,
|
||||||
|
"optimize": true,
|
||||||
|
"outputFormat": "commonjs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2265
pnpm-lock.yaml
2265
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,14 @@
|
||||||
import { setupLLVM, VERSIONS, getUrl, setupClangTools, getLinuxUrl } from "../llvm"
|
import { setupLLVM, VERSIONS, getUrl, setupClangTools, getLinuxUrl } from "../llvm"
|
||||||
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
||||||
import { isUrlOnline } from "is-url-online"
|
import { isUrlOnline } from "is-url-online"
|
||||||
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import ciDetect from "@npmcli/ci-detect"
|
||||||
import execa from "execa"
|
import execa from "execa"
|
||||||
import path, { addExeExt } from "patha"
|
import path, { addExeExt } from "patha"
|
||||||
import { chmodSync } from "fs"
|
import { chmodSync } from "fs"
|
||||||
import { getVersion } from "../../default_versions"
|
import { getVersion } from "../../default_versions"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
|
import * as io from "@actions/io"
|
||||||
|
|
||||||
jest.setTimeout(400000)
|
jest.setTimeout(400000)
|
||||||
async function testUrl(version: string) {
|
async function testUrl(version: string) {
|
||||||
|
@ -54,6 +55,7 @@ describe("setup-llvm", () => {
|
||||||
it("Finds valid LLVM URLs", async () => {
|
it("Finds valid LLVM URLs", async () => {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
[
|
[
|
||||||
|
"15.0.2",
|
||||||
// "14.0.1",
|
// "14.0.1",
|
||||||
"14.0.0",
|
"14.0.0",
|
||||||
"13.0.0",
|
"13.0.0",
|
||||||
|
@ -121,7 +123,27 @@ describe("setup-llvm", () => {
|
||||||
await testBin("clang-format", ["--version"], binDir)
|
await testBin("clang-format", ["--version"], binDir)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should setup LLVM 15.0.2", async () => {
|
||||||
|
await io.rmRF(directory)
|
||||||
|
await io.rmRF("/Users/runner/hostedtoolcache/llvm")
|
||||||
|
|
||||||
|
const { binDir } = await setupLLVM("15.0.2", directory, process.arch)
|
||||||
|
await testBin("clang++", ["--version"], binDir)
|
||||||
|
|
||||||
|
expect(process.env.CC?.includes("clang")).toBeTruthy()
|
||||||
|
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
|
||||||
|
|
||||||
|
// test compilation
|
||||||
|
const file = path.join(__dirname, "main.cpp")
|
||||||
|
const main_exe = path.join(__dirname, addExeExt("main"))
|
||||||
|
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname })
|
||||||
|
if (process.platform !== "win32") {
|
||||||
|
chmodSync(main_exe, "755")
|
||||||
|
}
|
||||||
|
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
||||||
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await cleanupTmpDir("llvm")
|
await io.rmRF(directory)
|
||||||
}, 100000)
|
}, 100000)
|
||||||
})
|
})
|
||||||
|
|
|
@ -71,6 +71,9 @@ export const VERSIONS: Set<string> = getVersions([
|
||||||
"14.0.4",
|
"14.0.4",
|
||||||
"14.0.5",
|
"14.0.5",
|
||||||
"14.0.6",
|
"14.0.6",
|
||||||
|
"15.0.0",
|
||||||
|
"15.0.1",
|
||||||
|
"15.0.2",
|
||||||
])
|
])
|
||||||
|
|
||||||
//================================================
|
//================================================
|
||||||
|
@ -174,10 +177,11 @@ const UBUNTU_SUFFIX_MAP: { [key: string]: string } = {
|
||||||
"13.0.1-ubuntu-18.04": "-ubuntu-18.04",
|
"13.0.1-ubuntu-18.04": "-ubuntu-18.04",
|
||||||
"14.0.0": "-ubuntu-18.04",
|
"14.0.0": "-ubuntu-18.04",
|
||||||
// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
|
// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
|
||||||
|
"15.0.2": "-rhel86",
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The latest supported LLVM version for the Linux (Ubuntu) platform. */
|
/** The latest supported LLVM version for the Linux (Ubuntu) platform. */
|
||||||
const MAX_UBUNTU: string = "14.0.0"
|
const MAX_UBUNTU: string = "15.0.2"
|
||||||
|
|
||||||
/** Gets an LLVM download URL for the Linux (Ubuntu) platform. */
|
/** Gets an LLVM download URL for the Linux (Ubuntu) platform. */
|
||||||
export function getLinuxUrl(versionGiven: string): string {
|
export function getLinuxUrl(versionGiven: string): string {
|
||||||
|
@ -188,25 +192,34 @@ export function getLinuxUrl(versionGiven: string): string {
|
||||||
version = rc
|
version = rc
|
||||||
}
|
}
|
||||||
|
|
||||||
let ubuntu: string
|
let linuxVersion: string
|
||||||
// ubuntu-version is specified
|
// ubuntu-version is specified
|
||||||
if (version.includes("ubuntu")) {
|
if (version.includes("ubuntu")) {
|
||||||
const givenUbuntuVersion = version.replace(/-ubuntu-.*/, "")
|
const givenUbuntuVersion = version.replace(/-ubuntu-.*/, "")
|
||||||
if (!VERSIONS.has(givenUbuntuVersion)) {
|
if (!VERSIONS.has(givenUbuntuVersion)) {
|
||||||
throw new Error(`Unsupported Ubuntu version: ${givenUbuntuVersion}`)
|
throw new Error(`Unsupported Ubuntu version: ${givenUbuntuVersion}`)
|
||||||
}
|
}
|
||||||
ubuntu = version.replace(givenUbuntuVersion, "")
|
linuxVersion = version.replace(givenUbuntuVersion, "")
|
||||||
version = getSpecificVersions(VERSIONS, givenUbuntuVersion)[0]
|
version = getSpecificVersions(VERSIONS, givenUbuntuVersion)[0]
|
||||||
} else if (version !== "" && version in UBUNTU_SUFFIX_MAP) {
|
} else if (version !== "" && version in UBUNTU_SUFFIX_MAP) {
|
||||||
ubuntu = UBUNTU_SUFFIX_MAP[version]
|
linuxVersion = UBUNTU_SUFFIX_MAP[version]
|
||||||
} else {
|
} else {
|
||||||
// default to the maximum version
|
// default to the maximum version
|
||||||
ubuntu = UBUNTU_SUFFIX_MAP[MAX_UBUNTU]
|
linuxVersion = UBUNTU_SUFFIX_MAP[MAX_UBUNTU]
|
||||||
warning(`Falling back to LLVM version ${MAX_UBUNTU} ${ubuntu} for the Ubuntu.`)
|
warning(`Falling back to LLVM version ${MAX_UBUNTU} ${linuxVersion} for the Ubuntu.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const prefix = "clang+llvm-"
|
const prefix = "clang+llvm-"
|
||||||
const suffix = version === "5.0.0" ? `-linux-x86_64${ubuntu}.tar.xz` : `-x86_64-linux-gnu${ubuntu}.tar.xz`
|
|
||||||
|
let suffix: string
|
||||||
|
if (version === "5.0.0") {
|
||||||
|
suffix = `-linux-x86_64${linuxVersion}.tar.xz`
|
||||||
|
} else if (linuxVersion.includes("-rhel86")) {
|
||||||
|
suffix = `-x86_64-unknown-linux-gnu${linuxVersion}.tar.xz`
|
||||||
|
} else {
|
||||||
|
suffix = `-x86_64-linux-gnu${linuxVersion}.tar.xz`
|
||||||
|
}
|
||||||
|
|
||||||
if (semverLte(version, "9.0.1")) {
|
if (semverLte(version, "9.0.1")) {
|
||||||
return getReleaseUrl(version, prefix, suffix)
|
return getReleaseUrl(version, prefix, suffix)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,69 +5,47 @@ import { info, warning } from "ci-log"
|
||||||
import { debug } from "@actions/core"
|
import { debug } from "@actions/core"
|
||||||
import { join } from "patha"
|
import { join } from "patha"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import ciDetect from "@npmcli/ci-detect"
|
||||||
import { isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS } from "setup-python/src/utils"
|
import { isCacheFeatureAvailable, IS_MAC } from "setup-python/src/utils"
|
||||||
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||||
|
|
||||||
function isPyPyVersion(versionSpec: string) {
|
function isPyPyVersion(versionSpec: string) {
|
||||||
return versionSpec.startsWith("pypy")
|
return versionSpec.startsWith("pypy")
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
function resolveVersionInput(version: string): string {
|
|
||||||
let versionFile = getInput("python-version-file")
|
|
||||||
|
|
||||||
if (version && versionFile) {
|
|
||||||
warning("Both python-version and python-version-file inputs are specified, only python-version will be used")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version) {
|
|
||||||
return version
|
|
||||||
}
|
|
||||||
|
|
||||||
versionFile = versionFile || ".python-version"
|
|
||||||
if (!existsSync(versionFile)) {
|
|
||||||
throw new Error(`The specified python version file at: ${versionFile} does not exist`)
|
|
||||||
}
|
|
||||||
version = readFileSync(versionFile, "utf8")
|
|
||||||
info(`Resolved ${versionFile} as ${version}`)
|
|
||||||
|
|
||||||
return version
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
export async function cacheDependencies(cache: string, pythonVersion: string) {
|
export async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||||
const cacheDependencyPath = undefined // core.getInput("cache-dependency-path") || undefined
|
const cacheDependencyPath = undefined
|
||||||
const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
||||||
await cacheDistributor.restoreCache()
|
await cacheDistributor.restoreCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const checkLatest = false
|
||||||
|
|
||||||
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
||||||
// According to the README windows binaries do not require to be installed
|
if (IS_MAC) {
|
||||||
// in the specific location, but Mac and Linux do
|
|
||||||
if (!IS_WINDOWS && !process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
|
||||||
if (IS_LINUX) {
|
|
||||||
process.env.AGENT_TOOLSDIRECTORY = "/opt/hostedtoolcache"
|
|
||||||
} else {
|
|
||||||
process.env.AGENT_TOOLSDIRECTORY = "/Users/runner/hostedtoolcache"
|
process.env.AGENT_TOOLSDIRECTORY = "/Users/runner/hostedtoolcache"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const agent_toolsdirectory = process.env.AGENT_TOOLSDIRECTORY?.trim()
|
||||||
|
if (typeof agent_toolsdirectory === "string" && agent_toolsdirectory !== "") {
|
||||||
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
|
process.env.RUNNER_TOOL_CACHE = process.env.AGENT_TOOLSDIRECTORY
|
||||||
}
|
}
|
||||||
debug(`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env.RUNNER_TOOL_CACHE}`)
|
|
||||||
// const version = resolveVersionInput(versionGiven)
|
debug(`Python is expected to be installed into ${process.env.RUNNER_TOOL_CACHE}`)
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
let pythonVersion: string
|
let pythonVersion: string
|
||||||
if (isPyPyVersion(version)) {
|
if (isPyPyVersion(version)) {
|
||||||
const installed = await findPyPyVersion(version, arch, true)
|
const installed = await findPyPyVersion(version, arch, true, checkLatest)
|
||||||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`
|
||||||
info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
|
info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`)
|
||||||
} else {
|
} else {
|
||||||
const installed = await useCpythonVersion(version, arch, true)
|
const installed = await useCpythonVersion(version, arch, true, checkLatest)
|
||||||
pythonVersion = installed.version
|
pythonVersion = installed.version
|
||||||
info(`Successfully set up ${installed.impl} (${pythonVersion})`)
|
info(`Successfully set up ${installed.impl} (${pythonVersion})`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCacheFeatureAvailable()) {
|
if (isCacheFeatureAvailable()) {
|
||||||
const cache = "pip" // core.getInput("cache") // package manager used for caching
|
const cache = "pip" // package manager used for caching
|
||||||
await cacheDependencies(cache, pythonVersion)
|
await cacheDependencies(cache, pythonVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,20 +47,31 @@ export async function getSpecificVersionAndUrl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the given set doesn't include the version, throw an error
|
||||||
if (!versions.has(version)) {
|
if (!versions.has(version)) {
|
||||||
throw new Error(`Unsupported target! (platform='${platform}', version='${version}')`)
|
throw new Error(`Unsupported target! (platform='${platform}', version='${version}')`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const offlineUrls: string[] = []
|
||||||
|
|
||||||
for (const specificVersion of getSpecificVersions(versions, version)) {
|
for (const specificVersion of getSpecificVersions(versions, version)) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
const url = await getUrl(platform, specificVersion)
|
const url = await getUrl(platform, specificVersion)
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
if (url !== null && (await isUrlOnline(url))) {
|
if (url !== null) {
|
||||||
|
if (await isUrlOnline(url)) {
|
||||||
return [specificVersion, url]
|
return [specificVersion, url]
|
||||||
|
} else {
|
||||||
|
offlineUrls.push(url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Unsupported target! (platform='${platform}', version='${version}')`)
|
throw new Error(
|
||||||
|
`Unsupported target! (platform='${platform}', version='${version}'). The offline urls tested:\n${offlineUrls.join(
|
||||||
|
"\n"
|
||||||
|
)}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultVersionRegex = /v?(\d\S*)/
|
export const defaultVersionRegex = /v?(\d\S*)/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": false,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
|
@ -28,5 +28,5 @@
|
||||||
"outDir": "./dist"
|
"outDir": "./dist"
|
||||||
},
|
},
|
||||||
"compileOnSave": false,
|
"compileOnSave": false,
|
||||||
"include": ["./src", "packages/untildify-user/untildify.ts"]
|
"include": ["./src", "dev/scripts", "packages/untildify-user/untildify.ts"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue