-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpsakefile.ps1
97 lines (75 loc) · 2.52 KB
/
psakefile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Task default -depends Build
Task Restore {
Exec { python -m pip install --upgrade build twine }
}
Task Rebuild {
$readme = $(Get-Childitem "README.md")[0]
Set-Location src
Write-Output "📦 Build main"
Copy-Item $readme ./README.md
Exec { python -m build -o ../dist }
Remove-Item ./README.md
Set-Location ..
}
Task Build -depends Restore, Rebuild
Task Deploy -depends Build {
Exec { python -m twine upload --skip-existing --repository pypi "dist/*" }
}
Task Install {
Write-Output "🛠 Install dependencies"
if ([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Linux)) {
Exec { sudo apt-get update >/dev/null }
}
elseif ([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::OSX)) {
}
elseif ([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)) {
}
Write-Output "🛠 Install main"
Set-Location ./dist
Exec { python -m pip install $(Get-Childitem "codesim-*.whl")[0] }
Set-Location ..
}
Task Uninstall {
Write-Output "⚒ Uninstall main"
Set-Location ./dist
Exec { python -m pip uninstall $(Get-Childitem "codesim*.whl")[0] -y }
Set-Location ..
}
Task Demo {
Write-Output "⏳ 1️⃣ Version ⏳"
Exec { codesim --version }
Write-Output "⏳ 2️⃣ Help ⏳"
Exec { codesim --help }
}
Task DataTest {
foreach ($file1 in Get-Childitem "./test/*.c") {
foreach ($file2 in Get-Childitem "./test/*.c") {
Write-Output "Compare $file1 $file2"
Write-Output "Time: $($(Measure-Command { Exec { codesim $file1 $file2 -vvv } | Out-Default}).TotalSeconds)"
}
}
}
Task LocalTest {
Set-Location ./src
foreach ($file1 in Get-Childitem "../test/*.c") {
foreach ($file2 in Get-Childitem "../test/*.c") {
Write-Output "Compare $file1 $file2"
Write-Output "Time: $($(Measure-Command { Exec { python -m codesim $file1 $file2 } | Out-Default}).TotalSeconds)"
}
}
Set-Location ..
}
Task Test -depends Install, Demo, DataTest, Uninstall
Task Clean {
Remove-Item -Recurse ./dist
foreach ($egg in Get-Childitem -Recurse *.egg-info) {
Write-Output "🗑 Remove $egg"
Remove-Item -Recurse $egg
}
}
Task Format {
autopep8 -r --in-place ./src
foreach ($file in Get-Childitem "./src/**/*.py" -Recurse) {
isort $file
}
}