Skip to content

Commit 7949fcb

Browse files
committed
Merge branch 'develop' into release/preview
# Conflicts: # Jenkinsfile
2 parents 45b823c + 2d2de40 commit 7949fcb

File tree

307 files changed

+6052
-3441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

307 files changed

+6052
-3441
lines changed

.gitattributes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
*.sh text eol=lf
1+
*.sh text eol=lf
2+
3+
install/opm text eol=lf
4+
install/oscript text eol=lf

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,6 @@ about: Предложить идею для проекта
44

55
---
66

7-
<!---
8-
## Уведомление от команды разработки
9-
10-
Проект 1Script разрабатывается командой на безвозмездной основе за счет личного времени.
11-
12-
За 4 года существования проекта, в него было подано более 800 задач и предложений. Все их отработать не представляется возможным. На каждой задаче, которую мы считаем посильной для реализации силами сообщества вешается зеленая плашка "help wanted". Это означает "Нужна помощь". За все время существования проекта, практически никто не взял и не сделал задачу с такой плашкой. Исключения единичны.
13-
14-
Подавая запрос на новую функциональность, учитывайте, пожалуйста, что скорее всего, Ваша задача сможет быть реализована только Вами самостоятельно.
15-
16-
Если вы не планируете реализовывать новую функциональность, то, возможно, и не стоит подавать запрос на нее?
17-
18-
С надеждой на понимание, EvilBeaver
19-
-->
20-
217
# Описание задачи
228

239
**Опишите вашу Цель, которую вы сможете достичь с помощью новой функциональности**

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"
12+

.github/workflows/rebase.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Automatic Rebase
2+
on:
3+
issue_comment:
4+
types: [created]
5+
jobs:
6+
rebase:
7+
name: Rebase
8+
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout the latest code
12+
uses: actions/checkout@v4
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
16+
- name: Automatic Rebase
17+
uses: cirrus-actions/[email protected]
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/sonar.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: QA
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
sonar:
9+
name: SonarQube
10+
runs-on: windows-latest
11+
if: (github.repository == 'EvilBeaver/OneScript' ) && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name)
12+
steps:
13+
- name: Set up JDK 17
14+
uses: actions/setup-java@v3
15+
with:
16+
java-version: 17
17+
distribution: temurin
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
21+
- name: Cache SonarQube packages
22+
uses: actions/cache@v3
23+
with:
24+
path: ~\sonar\cache
25+
key: ${{ runner.os }}-sonar
26+
restore-keys: ${{ runner.os }}-sonar
27+
- name: Cache SonarQube scanner
28+
id: cache-sonar-scanner
29+
uses: actions/cache@v3
30+
with:
31+
path: .\.sonar\scanner
32+
key: ${{ runner.os }}-sonar-scanner
33+
restore-keys: ${{ runner.os }}-sonar-scanner
34+
- name: Install SonarQube scanner
35+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
36+
shell: powershell
37+
run: |
38+
New-Item -Path .\.sonar\scanner -ItemType Directory
39+
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
40+
- name: Install coverage tool
41+
shell: powershell
42+
run: |
43+
dotnet tool install --global dotnet-coverage
44+
- name: Compute branch name
45+
uses: nelonoel/[email protected]
46+
- name: Prepare analysis (branch)
47+
if: github.event_name == 'push'
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
51+
shell: powershell
52+
run: |
53+
.\.sonar\scanner\dotnet-sonarscanner begin /k:"OneScript" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.branch.name=${{ env.BRANCH_NAME }} /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonar.openbsl.ru"
54+
- name: Prepare analysis (pull-request)
55+
if: github.event_name == 'pull_request'
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
59+
shell: powershell
60+
run: |
61+
.\.sonar\scanner\dotnet-sonarscanner begin /k:"OneScript" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.pullrequest.key=${{ github.event.pull_request.number }} /d:sonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} /d:sonar.pullrequest.base=${{ github.event.pull_request.base.ref }} /d:sonar.scm.revision=${{ github.event.pull_request.head.sha }} /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonar.openbsl.ru"
62+
- name: Build and analyze
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
65+
shell: powershell
66+
run: |
67+
dotnet publish src/oscript/oscript.csproj
68+
dotnet-coverage collect "dotnet msbuild Build_Core.csproj -t:UnitTests" -f xml -o "coverage.xml"
69+
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

Build_Core.csproj

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<BuildNumber Condition="'$(BUILD_NUMBER)' != ''">$(BUILD_NUMBER)</BuildNumber>
99
<BuildNumber Condition="'$(BUILD_NUMBER)' == ''">0</BuildNumber>
1010

11-
<ArtifactsRoot>$(MSBuildProjectDirectory)/built</ArtifactsRoot>
1211
<ArtifactsRoot>$(MSBuildProjectDirectory)/built</ArtifactsRoot>
1312
<LibDir>$(ArtifactsRoot)/lib</LibDir>
1413
<DebugAdapterDir>$(ArtifactsRoot)\vscode\</DebugAdapterDir>
@@ -70,7 +69,7 @@
7069
ItemName="BuildVariant"/>
7170
</CreateItem>
7271

73-
<Exec Command="dotnet publish &quot;src/%(BuildVariant.Identity)/%(BuildVariant.ProjectFile)&quot; -f %(BuildVariant.Framework) -c $(Configuration) -p:Platform=%(BuildVariant.Platform) -p:UseAppHost=false -o &quot;$(ArtifactsRoot)/fdd-%(BuildVariant.Suffix)/bin&quot;"/>
72+
<Exec Command="dotnet publish &quot;src/%(BuildVariant.Identity)/%(BuildVariant.ProjectFile)&quot; -f %(BuildVariant.Framework) -c $(Configuration) -p:Platform=%(BuildVariant.Platform) -p:UseAppHost=false -o &quot;$(ArtifactsRoot)/fdd-%(BuildVariant.Suffix)/bin&quot;" UseUtf8Encoding="Always"/>
7473

7574
<PropertyGroup>
7675
<CppBinPrefix>$(MSBuildProjectDirectory)/src/ScriptEngine.NativeApi/bin/$(Configuration)</CppBinPrefix>
@@ -84,6 +83,16 @@
8483
<Copy SourceFiles="@(CppX86)" DestinationFolder="$(ArtifactsRoot)/fdd-x86/bin" />
8584
<Copy SourceFiles="@(CppX64)" DestinationFolder="$(ArtifactsRoot)/fdd-x64/bin" />
8685

86+
<ItemGroup>
87+
<BatFilesFDD Include="$(MSBuildProjectDirectory)\install\opm.bat"/>
88+
<BatFilesFDD Include="$(MSBuildProjectDirectory)\install\oscript.bat"/>
89+
<ShFilesFDD Include="$(MSBuildProjectDirectory)\install\opm"/>
90+
<ShFilesFDD Include="$(MSBuildProjectDirectory)\install\oscript"/>
91+
</ItemGroup>
92+
93+
<Copy SourceFiles="@(BatFilesFDD);@(ShFilesFDD)" DestinationFolder="$(ArtifactsRoot)/fdd-x86/bin"/>
94+
<Copy SourceFiles="@(BatFilesFDD);@(ShFilesFDD)" DestinationFolder="$(ArtifactsRoot)/fdd-x64/bin"/>
95+
8796
</Target>
8897

8998
<Target Name="MakeSCD">
@@ -96,9 +105,9 @@
96105
<RuntimeID Include="osx-arm64"/>
97106
</ItemGroup>
98107

99-
<Exec Command="dotnet publish &quot;src/oscript/oscript.csproj&quot; -r %(RuntimeID.Identity) --self-contained -c $(Configuration) -o &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/bin&quot;"/>
108+
<Exec Command="dotnet publish &quot;src/oscript/oscript.csproj&quot; -r %(RuntimeID.Identity) --self-contained -c $(Configuration) -o &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/bin&quot;" UseUtf8Encoding="Always"/>
100109

101-
<PropertyGroup>
110+
<PropertyGroup>
102111
<CppBinPrefix>$(MSBuildProjectDirectory)/src/ScriptEngine.NativeApi/bin/$(Configuration)</CppBinPrefix>
103112
</PropertyGroup>
104113

@@ -110,6 +119,15 @@
110119
<Copy SourceFiles="@(CppX86)" DestinationFolder="$(ArtifactsRoot)/win-x86/bin" />
111120
<Copy SourceFiles="@(CppX64)" DestinationFolder="$(ArtifactsRoot)/win-x64/bin" />
112121

122+
<ItemGroup>
123+
<BatFilesSCD Include="$(MSBuildProjectDirectory)\install\opm.bat"/>
124+
<ShFilesSCD Include="$(MSBuildProjectDirectory)\install\opm"/>
125+
</ItemGroup>
126+
127+
<Copy SourceFiles="@(BatFilesSCD)" DestinationFolder="$(ArtifactsRoot)/win-x86/bin"/>
128+
<Copy SourceFiles="@(BatFilesSCD)" DestinationFolder="$(ArtifactsRoot)/win-x64/bin"/>
129+
<Copy SourceFiles="@(ShFilesSCD)" DestinationFolder="$(ArtifactsRoot)/linux-x64/bin"/>
130+
113131
</Target>
114132

115133
<Target Name="BuildDebugger">
@@ -163,11 +181,10 @@
163181
<Output TaskParameter="FirstItem" PropertyName="Runner"/>
164182
</GetFirstItem>
165183

166-
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(MSBuildProjectDirectory)/install/opm.ospx&quot; &quot;$(LibDir)/tmp&quot;"/>
167-
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(LibDir)/tmp/content.zip&quot; &quot;$(LibDir)/opm&quot;"/>
184+
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(MSBuildProjectDirectory)/install/opm.ospx&quot; &quot;$(LibDir)/tmp&quot;" UseUtf8Encoding="Always"/>
185+
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(LibDir)/tmp/content.zip&quot; &quot;$(LibDir)/opm&quot;" UseUtf8Encoding="Always"/>
168186

169187
<Copy SourceFiles="$(MSBuildProjectDirectory)\install\package-loader.os" DestinationFolder="$(LibDir)"/>
170-
<Copy SourceFiles="$(MSBuildProjectDirectory)\install\opm.bat" DestinationFolder="%(Executable.RelativeDir)"/>
171188
<RemoveDir Directories="$(LibDir)/tmp"/>
172189

173190
<PropertyGroup>
@@ -187,7 +204,8 @@
187204
<Exec Command="$(OpmLaunch) install -d &quot;$(LibDir)&quot; %(CoreLibraries.Identity)"
188205
IgnoreExitCode="false"
189206
EnvironmentVariables="@(ConfigEnv)"
190-
Condition="'$(SkipLibraryDownload)' == ''"/>
207+
Condition="'$(SkipLibraryDownload)' == ''"
208+
UseUtf8Encoding="Always"/>
191209

192210
</Target>
193211

@@ -239,6 +257,7 @@
239257
WorkingDirectory="$(TestsRoot)/%(TestAssemblies.Identity)"
240258
Command="dotnet test --logger:&quot;junit;LogFilePath=$(MSBuildProjectDirectory)/tests/%(TestAssemblies.Identity).xml&quot;"
241259
IgnoreExitCode="true"
260+
UseUtf8Encoding="Always"
242261
/>
243262

244263
</Target>
@@ -255,7 +274,14 @@
255274
<Output TaskParameter="FirstItem" PropertyName="Runner"/>
256275
</GetFirstItem>
257276

258-
<Exec WorkingDirectory="$(MSBuildProjectDirectory)\tests" Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\tests\testrunner.os&quot; -runall . xddReportPath ." IgnoreExitCode="true"/>
277+
<Exec
278+
WorkingDirectory="$(MSBuildProjectDirectory)\tests"
279+
Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\tests\testrunner.os&quot; -runall . xddReportPath ."
280+
IgnoreExitCode="true"
281+
ContinueOnError="true"
282+
UseUtf8Encoding="Always">
283+
<Output TaskParameter="ExitCode" PropertyName="TestsExitCode"/>
284+
</Exec>
259285

260286
</Target>
261287

@@ -284,7 +310,7 @@
284310
<Output TaskParameter="FirstItem" PropertyName="Runner"/>
285311
</GetFirstItem>
286312

287-
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\install\unicode-zipper.os&quot; pack &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/*&quot; &quot;$(ArtifactsRoot)/OneScript-$(ReleaseNumber)-%(RuntimeID.Identity).zip&quot;"/>
313+
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\install\unicode-zipper.os&quot; pack &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/*&quot; &quot;$(ArtifactsRoot)/OneScript-$(ReleaseNumber)-%(RuntimeID.Identity).zip&quot;" UseUtf8Encoding="Always"/>
288314
<RemoveDir Directories="$(ArtifactsRoot)/%(RuntimeID.Identity)" />
289315
</Target>
290316

@@ -323,7 +349,7 @@
323349

324350
<Error Text="No nuget token (/p:NugetToken=) specified" Condition="'$(NugetToken)' == ''" />
325351
<Exec WorkingDirectory="$(MSBuildProjectDirectory)\built\nuget"
326-
Command="dotnet nuget push %(NugetAbleProject.Identity).$(ReleaseNumber).nupkg -k $(NugetToken) -s https://api.nuget.org/v3/index.json"/>
352+
Command="dotnet nuget push %(NugetAbleProject.Identity).$(ReleaseNumber).nupkg -k $(NugetToken) -s https://api.nuget.org/v3/index.json" UseUtf8Encoding="Always"/>
327353

328354
</Target>
329355

Jenkinsfile

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@ pipeline {
55

66
environment {
77
VersionPrefix = '2.0.0'
8-
VersionSuffix = 'rc2'
8+
VersionSuffix = 'rc3'
99
outputEnc = '65001'
1010
}
1111

1212
stages {
13+
stage('Prepare Linux Environment') {
14+
agent{ label 'master'}
15+
steps{
16+
dir('install'){
17+
sh 'chmod +x make-dockers.sh && ./make-dockers.sh'
18+
}
19+
withCredentials([usernamePassword(credentialsId: 'docker-hub', passwordVariable: 'dockerpassword', usernameVariable: 'dockeruser')]) {
20+
sh """
21+
docker login -p $dockerpassword -u $dockeruser
22+
docker push oscript/onescript-builder:deb
23+
docker push oscript/onescript-builder:rpm
24+
docker push oscript/onescript-builder:gcc
25+
""".stripIndent()
26+
}
27+
}
28+
}
1329
stage('Build'){
1430
parallel {
15-
stage('Prepare Linux Environment') {
16-
agent{ label 'master'}
17-
steps{
18-
dir('install'){
19-
sh 'chmod +x make-dockers.sh && ./make-dockers.sh'
20-
}
21-
withCredentials([usernamePassword(credentialsId: 'docker-hub', passwordVariable: 'dockerpassword', usernameVariable: 'dockeruser')]) {
22-
sh """
23-
docker login -p $dockerpassword -u $dockeruser
24-
docker push oscript/onescript-builder:deb
25-
docker push oscript/onescript-builder:rpm
26-
""".stripIndent()
27-
}
28-
}
29-
}
30-
3131
stage('Windows Build') {
3232
agent { label 'windows' }
3333

@@ -64,6 +64,32 @@ pipeline {
6464
}
6565
}
6666
}
67+
68+
stage('Linux Build') {
69+
agent {
70+
docker {
71+
image 'oscript/onescript-builder:gcc'
72+
label 'linux'
73+
}
74+
}
75+
76+
steps {
77+
sh 'mkdir -p built/tmp/na-proxy && mkdir -p built/tmp/na-tests'
78+
dir('src/ScriptEngine.NativeApi') {
79+
sh './build.sh'
80+
sh 'cp *.so ../../built/tmp/na-proxy'
81+
}
82+
dir('tests/native-api') {
83+
sh './build.sh'
84+
sh 'cp *.so ../../built/tmp/na-tests'
85+
}
86+
dir('output') {
87+
sh 'cp -Rv ../built/tmp/* .'
88+
}
89+
stash includes: 'output/na-proxy/*.so', name: 'nativeApiSo'
90+
stash includes: 'output/na-tests/*.so', name: 'nativeApiTestsSo'
91+
}
92+
}
6793
}
6894
}
6995
stage('VSCode debugger Build') {
@@ -125,6 +151,11 @@ pipeline {
125151
}
126152

127153
unstash 'buildResults'
154+
unstash 'nativeApiSo'
155+
unstash 'nativeApiTestsSo'
156+
157+
sh 'cp output/na-proxy/*.so ./built/linux-x64/bin/'
158+
sh 'mkdir -p tests/native-api/build64 && cp output/na-tests/*.so ./tests/native-api/build64/'
128159

129160
sh '''\
130161
if [ ! -d lintests ]; then
@@ -154,6 +185,10 @@ pipeline {
154185
}
155186

156187
unstash 'buildResults'
188+
unstash 'nativeApiSo'
189+
190+
bat 'xcopy output\\na-proxy\\*64.so built\\linux-64\\bin\\'
191+
157192
script
158193
{
159194
if (env.BRANCH_NAME == "preview") {
@@ -197,7 +232,7 @@ pipeline {
197232
}
198233
}
199234

200-
stage ('Publishing preview') {
235+
stage ('Publishing preview') {
201236
when { anyOf {
202237
branch 'release/preview';
203238
}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,11 @@ OneScript позволяет создавать и выполнять текст
4646
- выполнить команду `mono ovm.exe install stable`
4747
- выполнить команду `mono ovm.exe use stable`
4848
- перезапустить терминал
49+
50+
Донастройка Self-Contained варианта поставки (не требующего инсталляции dotnet)
51+
52+
```
53+
chmod +x ./oscript
54+
xattr -d com.apple.quarantine *.dylib oscript
55+
codesign -s - ./oscript
56+
```

install/builders/deb/oscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
2-
mono /usr/share/oscript/bin/oscript.exe "$@"
2+
dotnet /usr/share/oscript/bin/oscript.dll "$@"
33

install/builders/deb/oscript-cgi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ if [ -z "$SCRIPT_FILENAME" ]; then
44
export SCRIPT_FILENAME=$1
55
fi
66

7-
mono /usr/share/oscript/bin/oscript.exe -cgi "$@"
7+
oscript -cgi "$@"
88

0 commit comments

Comments
 (0)