Skip to content

Commit 9434cbc

Browse files
committed
v0.2.0
1 parent c2ffbd5 commit 9434cbc

File tree

7 files changed

+140
-39
lines changed

7 files changed

+140
-39
lines changed

action.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: The name of your action here
2-
description: Provide a description here
3-
author: Your name or organization here
1+
name: setup-smt
2+
description: Download and provides the z3 and cvc5 SMT solvers
3+
author: Alexander Weigl
44

55
# Add your action's branding here. This will appear on the GitHub Marketplace.
66
branding:
@@ -9,15 +9,15 @@ branding:
99

1010
# Define your inputs here.
1111
inputs:
12-
milliseconds:
13-
description: Your input description here
12+
z3Version:
13+
description: Version of Z3 to install
1414
required: true
15-
default: '1000'
15+
default: '4.13.3'
1616

17-
# Define your outputs here.
18-
outputs:
19-
time:
20-
description: Your output description here
17+
cvc5Version:
18+
description: Version of CVC5 to install
19+
required: true
20+
default: '1.2.1'
2121

2222
runs:
2323
using: node20

dist/index.js

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.d.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "setup-smt",
33
"description": "GitHub Actions for setting up SMT",
4-
"version": "0.1.3",
4+
"version": "0.2.0",
55
"author": "",
66
"type": "module",
77
"private": true,
8-
"homepage": "https://github.com/actions/typescript-action",
8+
"homepage": "https://github.com/keyproject/setup-smt",
99
"repository": {
1010
"type": "git",
11-
"url": "git+https://github.com/actions/typescript-action.git"
11+
"url": "git+https://github.com/keyproject/setup-smt.git"
1212
},
1313
"bugs": {
14-
"url": "https://github.com/actions/typescript-action/issues"
14+
"url": "https://github.com/keyproject/setup-smt/issues"
1515
},
1616
"keywords": [
1717
"actions"

src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/**
2-
* The entrypoint for the action. This file simply imports and runs the action's
3-
* main logic.
4-
*/
51
import { run } from './main.js'
62

7-
/* istanbul ignore next */
83
run()

src/main.ts

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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(
23+
tool: string,
24+
version: string,
25+
urls: Tools
26+
): Promise<void> {
27+
if (!version) {
28+
return
29+
}
30+
31+
let toolPath = tc.find(tool, version, platform)
32+
33+
const info: Tool | undefined = urls[platform]
34+
35+
if (info === undefined) {
36+
return
37+
}
38+
39+
if (!toolPath) {
40+
const downloadPath = await tc.downloadTool(info.url)
41+
let extractedPath: string
42+
43+
switch (info.format) {
44+
case 'tar':
45+
extractedPath = await tc.extractTar(downloadPath)
46+
break
47+
case '7z':
48+
extractedPath = await tc.extract7z(downloadPath)
49+
break
50+
case 'xar':
51+
extractedPath = await tc.extractXar(downloadPath)
52+
break
53+
default:
54+
extractedPath = await tc.extractZip(downloadPath)
55+
}
56+
57+
toolPath = await tc.cacheDir(extractedPath, tool, version, platform)
58+
}
59+
60+
core.addPath(`${toolPath}/${info.binPath}`)
61+
core.debug(`${toolPath}/${info.binPath} to PATH`)
62+
}
63+
64+
export async function run(): Promise<void> {
65+
core.debug(`Platform: ${platform}`)
66+
67+
const z3Version = core.getInput('z3Version')
68+
69+
await download('z3', z3Version, {
70+
linux: {
71+
url: `https://github.com/Z3Prover/z3/releases/download/z3-${z3Version}/z3-${z3Version}-x64-glibc-2.35.zip`,
72+
format: 'zip',
73+
binPath: `z3-${z3Version}-x64-glibc-2.35/bin/`
74+
},
75+
windows: {
76+
url: `https://github.com/Z3Prover/z3/releases/download/z3-${z3Version}/z3-${z3Version}-x64-win.zip`,
77+
format: 'zip',
78+
binPath: `z3-${z3Version}-x64-win/bin/`
79+
},
80+
macos: {
81+
url: `https://github.com/Z3Prover/z3/releases/download/z3-${z3Version}/z3-${z3Version}-x64-osx-13.7.2.zip`,
82+
format: 'zip',
83+
binPath: `z3-${z3Version}-osx/bin/`
84+
}
85+
})
86+
87+
const cvc5Version = core.getInput('cv5Version')
88+
await download('cvc5', cvc5Version, {
89+
linux: {
90+
url: `https://github.com/cvc5/cvc5/releases/download/cvc5-${cvc5Version}/cvc5-Linux-x86_64-static.zip`,
91+
format: 'zip',
92+
binPath: `cvc5-Linux-x86_64-static/bin/`
93+
},
94+
windows: {
95+
url: `https://github.com/cvc5/cvc5/releases/download/cvc5-${cvc5Version}/cvc5-Win64-x86_64-static.zip`,
96+
format: 'zip',
97+
binPath: `cvc5-Win64-x86_64-static/bin/`
98+
},
99+
macos: {
100+
url: `https://github.com/cvc5/cvc5/releases/download/cvc5-${cvc5Version}/cvc5-macOS-x86_64-static.zip`,
101+
format: 'zip',
102+
binPath: `cvc5-macOS-x86_64-static/bin/`
103+
}
104+
})
105+
}

0 commit comments

Comments
 (0)