|
1 | | -import * as tc from '@actions/tool-cache' |
2 | | -import * as core from '@actions/core' |
3 | | -import { env } from 'process' |
4 | | - |
5 | | -interface Tools { |
6 | | - linux: Tool | undefined |
7 | | - windows: Tool | undefined |
8 | | - macos: Tool | undefined |
9 | | -} |
10 | | - |
11 | | -interface Tool { |
12 | | - url: string |
13 | | - format: string |
14 | | - binPath: string |
15 | | -} |
16 | | - |
17 | | -type Platform = 'linux' | 'windows' | 'macos' |
18 | | - |
19 | | -// The operating system of the runner executing the job. Possible values are Linux, Windows, or macOS. For example, Windows |
20 | | -const platform: Platform = (env.RUNNER_OS?.toLowerCase() || 'linux') as Platform |
21 | | - |
22 | | -async function download(tool: string, version: string, urls: Tools) { |
23 | | - let toolPath = tc.find(tool, version, platform) |
24 | | - |
25 | | - const info: Tool | undefined = urls[platform] |
26 | | - |
27 | | - if (info === undefined) { |
28 | | - return |
29 | | - } |
30 | | - |
31 | | - if (!toolPath) { |
32 | | - const downloadPath = await tc.downloadTool(info.url) |
33 | | - let extractedPath: string |
34 | | - |
35 | | - switch (info.format) { |
36 | | - case 'tar': |
37 | | - extractedPath = await tc.extractTar(downloadPath) |
38 | | - break |
39 | | - case '7z': |
40 | | - extractedPath = await tc.extract7z(downloadPath) |
41 | | - break |
42 | | - case 'xar': |
43 | | - extractedPath = await tc.extractXar(downloadPath) |
44 | | - break |
45 | | - default: |
46 | | - extractedPath = await tc.extractZip(downloadPath) |
47 | | - } |
48 | | - |
49 | | - toolPath = await tc.cacheDir(extractedPath, tool, version, platform) |
50 | | - } |
51 | | - |
52 | | - core.addPath(`${toolPath}/${info.binPath}`) |
53 | | - core.debug(`${toolPath}/${info.binPath} to PATH`) |
54 | | -} |
55 | | -export async function run(): Promise<void> { |
56 | | - await download('z3', '4.14.0', { |
57 | | - linux: { |
58 | | - url: 'https://github.com/Z3Prover/z3/releases/download/z3-4.14.0/z3-4.14.0-x64-glibc-2.35.zip', |
59 | | - format: 'zip', |
60 | | - binPath: 'z3-4.14.0-x64-glibc-2.35/bin/' |
61 | | - }, |
62 | | - windows: { |
63 | | - url: 'https://github.com/Z3Prover/z3/releases/download/z3-4.14.0/z3-4.14.0-x64-win.zip', |
64 | | - format: 'zip', |
65 | | - binPath: 'z3-4.14.0-x64-win/bin/' |
66 | | - }, |
67 | | - macos: { |
68 | | - url: 'https://github.com/Z3Prover/z3/releases/download/z3-4.14.0/z3-4.14.0-x64-osx-13.7.2.zip', |
69 | | - format: 'zip', |
70 | | - binPath: 'z3-4.14.0-osx/bin/' |
71 | | - } |
72 | | - }) |
73 | | - |
74 | | - await download('cvc5', '1.2.1', { |
75 | | - linux: { |
76 | | - url: 'https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.1/cvc5-Linux-x86_64-static.zip', |
77 | | - format: 'zip', |
78 | | - binPath: 'cvc5-Linux-x86_64-static/bin/' |
79 | | - }, |
80 | | - windows: { |
81 | | - url: 'https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.1/cvc5-Win64-x86_64-static.zip', |
82 | | - format: 'zip', |
83 | | - binPath: 'cvc5-Win64-x86_64-static/bin/' |
84 | | - }, |
85 | | - macos: { |
86 | | - url: 'https://github.com/cvc5/cvc5/releases/download/cvc5-1.2.1/cvc5-macOS-x86_64-static.zip', |
87 | | - format: 'zip', |
88 | | - binPath: 'cvc5-macOs-x86_64-static/bin/' |
89 | | - } |
90 | | - }) |
91 | | -} |
| 1 | +/** |
| 2 | + * The entrypoint for the action. This file simply imports and runs the action's |
| 3 | + * main logic. |
| 4 | + */ |
| 5 | +import { run } from './main.js' |
| 6 | + |
| 7 | +/* istanbul ignore next */ |
| 8 | +run() |
0 commit comments