Skip to content

Commit

Permalink
Merge branch 'develop' into release/preview
Browse files Browse the repository at this point in the history
# Conflicts:
#	Jenkinsfile
  • Loading branch information
EvilBeaver committed Oct 16, 2023
2 parents 45b823c + 2d2de40 commit 7949fcb
Show file tree
Hide file tree
Showing 307 changed files with 6,052 additions and 3,441 deletions.
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.sh text eol=lf
*.sh text eol=lf

install/opm text eol=lf
install/oscript text eol=lf
14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@ about: Предложить идею для проекта

---

<!---
## Уведомление от команды разработки
Проект 1Script разрабатывается командой на безвозмездной основе за счет личного времени.
За 4 года существования проекта, в него было подано более 800 задач и предложений. Все их отработать не представляется возможным. На каждой задаче, которую мы считаем посильной для реализации силами сообщества вешается зеленая плашка "help wanted". Это означает "Нужна помощь". За все время существования проекта, практически никто не взял и не сделал задачу с такой плашкой. Исключения единичны.
Подавая запрос на новую функциональность, учитывайте, пожалуйста, что скорее всего, Ваша задача сможет быть реализована только Вами самостоятельно.
Если вы не планируете реализовывать новую функциональность, то, возможно, и не стоит подавать запрос на нее?
С надеждой на понимание, EvilBeaver
-->

# Описание задачи

**Опишите вашу Цель, которую вы сможете достичь с помощью новой функциональности**
Expand Down
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

19 changes: 19 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Automatic Rebase
uses: cirrus-actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69 changes: 69 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: QA

on:
push:
pull_request:

jobs:
sonar:
name: SonarQube
runs-on: windows-latest
if: (github.repository == 'EvilBeaver/OneScript' ) && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name)
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarQube packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarQube scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Install coverage tool
shell: powershell
run: |
dotnet tool install --global dotnet-coverage
- name: Compute branch name
uses: nelonoel/[email protected]
- name: Prepare analysis (branch)
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.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"
- name: Prepare analysis (pull-request)
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.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"
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
shell: powershell
run: |
dotnet publish src/oscript/oscript.csproj
dotnet-coverage collect "dotnet msbuild Build_Core.csproj -t:UnitTests" -f xml -o "coverage.xml"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
48 changes: 37 additions & 11 deletions Build_Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<BuildNumber Condition="'$(BUILD_NUMBER)' != ''">$(BUILD_NUMBER)</BuildNumber>
<BuildNumber Condition="'$(BUILD_NUMBER)' == ''">0</BuildNumber>

<ArtifactsRoot>$(MSBuildProjectDirectory)/built</ArtifactsRoot>
<ArtifactsRoot>$(MSBuildProjectDirectory)/built</ArtifactsRoot>
<LibDir>$(ArtifactsRoot)/lib</LibDir>
<DebugAdapterDir>$(ArtifactsRoot)\vscode\</DebugAdapterDir>
Expand Down Expand Up @@ -70,7 +69,7 @@
ItemName="BuildVariant"/>
</CreateItem>

<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;"/>
<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"/>

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

<ItemGroup>
<BatFilesFDD Include="$(MSBuildProjectDirectory)\install\opm.bat"/>
<BatFilesFDD Include="$(MSBuildProjectDirectory)\install\oscript.bat"/>
<ShFilesFDD Include="$(MSBuildProjectDirectory)\install\opm"/>
<ShFilesFDD Include="$(MSBuildProjectDirectory)\install\oscript"/>
</ItemGroup>

<Copy SourceFiles="@(BatFilesFDD);@(ShFilesFDD)" DestinationFolder="$(ArtifactsRoot)/fdd-x86/bin"/>
<Copy SourceFiles="@(BatFilesFDD);@(ShFilesFDD)" DestinationFolder="$(ArtifactsRoot)/fdd-x64/bin"/>

</Target>

<Target Name="MakeSCD">
Expand All @@ -96,9 +105,9 @@
<RuntimeID Include="osx-arm64"/>
</ItemGroup>

<Exec Command="dotnet publish &quot;src/oscript/oscript.csproj&quot; -r %(RuntimeID.Identity) --self-contained -c $(Configuration) -o &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/bin&quot;"/>
<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"/>

<PropertyGroup>
<PropertyGroup>
<CppBinPrefix>$(MSBuildProjectDirectory)/src/ScriptEngine.NativeApi/bin/$(Configuration)</CppBinPrefix>
</PropertyGroup>

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

<ItemGroup>
<BatFilesSCD Include="$(MSBuildProjectDirectory)\install\opm.bat"/>
<ShFilesSCD Include="$(MSBuildProjectDirectory)\install\opm"/>
</ItemGroup>

<Copy SourceFiles="@(BatFilesSCD)" DestinationFolder="$(ArtifactsRoot)/win-x86/bin"/>
<Copy SourceFiles="@(BatFilesSCD)" DestinationFolder="$(ArtifactsRoot)/win-x64/bin"/>
<Copy SourceFiles="@(ShFilesSCD)" DestinationFolder="$(ArtifactsRoot)/linux-x64/bin"/>

</Target>

<Target Name="BuildDebugger">
Expand Down Expand Up @@ -163,11 +181,10 @@
<Output TaskParameter="FirstItem" PropertyName="Runner"/>
</GetFirstItem>

<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(MSBuildProjectDirectory)/install/opm.ospx&quot; &quot;$(LibDir)/tmp&quot;"/>
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(LibDir)/tmp/content.zip&quot; &quot;$(LibDir)/opm&quot;"/>
<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"/>
<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"/>

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

<PropertyGroup>
Expand All @@ -187,7 +204,8 @@
<Exec Command="$(OpmLaunch) install -d &quot;$(LibDir)&quot; %(CoreLibraries.Identity)"
IgnoreExitCode="false"
EnvironmentVariables="@(ConfigEnv)"
Condition="'$(SkipLibraryDownload)' == ''"/>
Condition="'$(SkipLibraryDownload)' == ''"
UseUtf8Encoding="Always"/>

</Target>

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

</Target>
Expand All @@ -255,7 +274,14 @@
<Output TaskParameter="FirstItem" PropertyName="Runner"/>
</GetFirstItem>

<Exec WorkingDirectory="$(MSBuildProjectDirectory)\tests" Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\tests\testrunner.os&quot; -runall . xddReportPath ." IgnoreExitCode="true"/>
<Exec
WorkingDirectory="$(MSBuildProjectDirectory)\tests"
Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\tests\testrunner.os&quot; -runall . xddReportPath ."
IgnoreExitCode="true"
ContinueOnError="true"
UseUtf8Encoding="Always">
<Output TaskParameter="ExitCode" PropertyName="TestsExitCode"/>
</Exec>

</Target>

Expand Down Expand Up @@ -284,7 +310,7 @@
<Output TaskParameter="FirstItem" PropertyName="Runner"/>
</GetFirstItem>

<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;"/>
<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"/>
<RemoveDir Directories="$(ArtifactsRoot)/%(RuntimeID.Identity)" />
</Target>

Expand Down Expand Up @@ -323,7 +349,7 @@

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

</Target>

Expand Down
71 changes: 53 additions & 18 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ pipeline {

environment {
VersionPrefix = '2.0.0'
VersionSuffix = 'rc2'
VersionSuffix = 'rc3'
outputEnc = '65001'
}

stages {
stage('Prepare Linux Environment') {
agent{ label 'master'}
steps{
dir('install'){
sh 'chmod +x make-dockers.sh && ./make-dockers.sh'
}
withCredentials([usernamePassword(credentialsId: 'docker-hub', passwordVariable: 'dockerpassword', usernameVariable: 'dockeruser')]) {
sh """
docker login -p $dockerpassword -u $dockeruser
docker push oscript/onescript-builder:deb
docker push oscript/onescript-builder:rpm
docker push oscript/onescript-builder:gcc
""".stripIndent()
}
}
}
stage('Build'){
parallel {
stage('Prepare Linux Environment') {
agent{ label 'master'}
steps{
dir('install'){
sh 'chmod +x make-dockers.sh && ./make-dockers.sh'
}
withCredentials([usernamePassword(credentialsId: 'docker-hub', passwordVariable: 'dockerpassword', usernameVariable: 'dockeruser')]) {
sh """
docker login -p $dockerpassword -u $dockeruser
docker push oscript/onescript-builder:deb
docker push oscript/onescript-builder:rpm
""".stripIndent()
}
}
}

stage('Windows Build') {
agent { label 'windows' }

Expand Down Expand Up @@ -64,6 +64,32 @@ pipeline {
}
}
}

stage('Linux Build') {
agent {
docker {
image 'oscript/onescript-builder:gcc'
label 'linux'
}
}

steps {
sh 'mkdir -p built/tmp/na-proxy && mkdir -p built/tmp/na-tests'
dir('src/ScriptEngine.NativeApi') {
sh './build.sh'
sh 'cp *.so ../../built/tmp/na-proxy'
}
dir('tests/native-api') {
sh './build.sh'
sh 'cp *.so ../../built/tmp/na-tests'
}
dir('output') {
sh 'cp -Rv ../built/tmp/* .'
}
stash includes: 'output/na-proxy/*.so', name: 'nativeApiSo'
stash includes: 'output/na-tests/*.so', name: 'nativeApiTestsSo'
}
}
}
}
stage('VSCode debugger Build') {
Expand Down Expand Up @@ -125,6 +151,11 @@ pipeline {
}

unstash 'buildResults'
unstash 'nativeApiSo'
unstash 'nativeApiTestsSo'

sh 'cp output/na-proxy/*.so ./built/linux-x64/bin/'
sh 'mkdir -p tests/native-api/build64 && cp output/na-tests/*.so ./tests/native-api/build64/'

sh '''\
if [ ! -d lintests ]; then
Expand Down Expand Up @@ -154,6 +185,10 @@ pipeline {
}

unstash 'buildResults'
unstash 'nativeApiSo'

bat 'xcopy output\\na-proxy\\*64.so built\\linux-64\\bin\\'

script
{
if (env.BRANCH_NAME == "preview") {
Expand Down Expand Up @@ -197,7 +232,7 @@ pipeline {
}
}

stage ('Publishing preview') {
stage ('Publishing preview') {
when { anyOf {
branch 'release/preview';
}
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@ OneScript позволяет создавать и выполнять текст
- выполнить команду `mono ovm.exe install stable`
- выполнить команду `mono ovm.exe use stable`
- перезапустить терминал

Донастройка Self-Contained варианта поставки (не требующего инсталляции dotnet)

```
chmod +x ./oscript
xattr -d com.apple.quarantine *.dylib oscript
codesign -s - ./oscript
```
2 changes: 1 addition & 1 deletion install/builders/deb/oscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
mono /usr/share/oscript/bin/oscript.exe "$@"
dotnet /usr/share/oscript/bin/oscript.dll "$@"

2 changes: 1 addition & 1 deletion install/builders/deb/oscript-cgi
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ if [ -z "$SCRIPT_FILENAME" ]; then
export SCRIPT_FILENAME=$1
fi

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

Loading

0 comments on commit 7949fcb

Please sign in to comment.