Skip to content

Update variables naming #194

Update variables naming

Update variables naming #194

Workflow file for this run

name: CD
on:
push:
branches: main
env:
NUGETTOKEN: ${{ secrets.NUGET_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SCRIPTS_BASE_URL: https://raw.githubusercontent.com/linksplatform/Scripts/main/MultiProjectRepository
jobs:
findCppDirectory:
runs-on: ubuntu-latest
outputs:
isCppDirectoryFound: ${{steps.findCppDirectory.outputs.isCppDirectoryFound}}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Find cpp directory
id: findCppDirectory
run: |
if [ -d "cpp" ]
then
echo "Directory cpp exists."
echo "::set-output name=isCppDirectoryFound::true"
else
echo "Directory cpp does not exists."
echo "::set-output name=isCppDirectoryFound::false"
fi
testCpp:
runs-on: ubuntu-latest
needs: findCppDirectory
if: needs.findCppDirectory.outputs.isCppDirectoryFound == 'true'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Install conan
run: pip install conan
- name: Setup conan
run: |
conan profile new linksplatform --detect
conan profile update settings.compiler=clang linksplatform
conan profile update settings.compiler.version=13 linksplatform
conan profile update settings.compiler.libcxx=libstdc++11 linksplatform
conan profile update env.CXX=clang++ linksplatform
conan profile show linksplatform
- name: Instll conan packages
run: |
git clone https://github.com/linksplatform/conan-center-index
cd conan-center-index && git checkout only-development && cd recipes
conan create platform.interfaces/0.2.0+ platform.interfaces/0.2.5@ -pr=linksplatform
conan create platform.ranges/all platform.ranges/0.1.3@ -pr=linksplatform
conan create platform.random/all platform.random/0.1.0@ -pr=linksplatform
conan create platform.collections/all platform.collections/0.1.0@ -pr=linksplatform
conan create platform.collections.methods/all platform.collections.methods/0.1.0@ -pr=linksplatform
conan create platform.converters/all platform.converters/0.1.0@ -pr=linksplatform
conan create platform.threading/all platform.threading/0.1.0@ -pr=linksplatform
conan create platform.memory/all platform.memory/0.1.0@ -pr=linksplatform
conan create platform.data/all platform.data/0.1.0@ -pr=linksplatform
conan create platform.delegates/all platform.delegates/0.1.3@ -pr=linksplatform
conan create platform.setters/all platform.setters/0.0.1@ -pr=linksplatform
conan create platform.equality/all platform.equality/0.0.1@ -pr=linksplatform
conan create platform.exceptions/all platform.exceptions/0.2.0@ -pr=linksplatform
conan create platform.hashing/all platform.hashing/0.2.0@ -pr=linksplatform
- name: Test C++ and scan-build
run: |
$CXX=clang++
$cmake_flags="-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DLINKS_PLATFORM_TESTS=TRUE"
$cmake_build_dir="build"
cd cpp && mkdir $cmake_build_dir && cd $cmake_build_dir
conan install $pwd/.. -pr=linksplatform --build=missing
cmake .. $cmake_flags
cmake --build .
ls
findCsharpDirectory:
runs-on: ubuntu-latest
outputs:
isCsharpDirectoryFound: ${{steps.findCsharpDirectory.outputs.isCsharpDirectoryFound}}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Find csharp directory
id: findCsharpDirectory
run: |
if [ -d "csharp" ]
then
echo "Directory csharp exists."
echo "::set-output name=isCsharpDirectoryFound::true"
else
echo "Directory csharp does not exists."
echo "::set-output name=isCsharpDirectoryFound::false"
fi
testCs:
runs-on: ubuntu-latest
needs: findCsharpDirectory
if: needs.findCsharpDirectory.outputs.isCsharpDirectoryFound == 'true'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Test C#
run: |
dotnet test -c Release -f net6
deployCpp:
runs-on: ubuntu-latest
needs: testCpp
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Read Cpp package information
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/read_cpp_package_info.sh"
bash ./read_cpp_package_info.sh
- name: Publish Cpp NuGet package
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/push-cpp-nuget.sh"
bash ./push-cpp-nuget.sh
deployCs:
runs-on: ubuntu-latest
needs: testCs
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Read CSharp project information
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/read_csharp_package_info.sh"
bash ./read_csharp_package_info.sh
- name: Publish CSharp NuGet package
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/push-csharp-nuget.sh"
bash ./push-csharp-nuget.sh
publiseRelease:
runs-on: ubuntu-latest
needs: [deployCpp, deployCs]
if: ((needs.deployCpp.result == 'skipped' && needs.deployCs.result != 'skipped') || (needs.deployCpp.result != 'skipped' && needs.deployCs.result == 'skipped')) && !failure() && !cancelled()
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Publish release
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/publish-release.sh"
bash ./publish-release.sh
pushCSharpNuGetToGitHubPackageRegistry:
needs: publiseRelease
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: nuget/setup-nuget@v1
- name: Publish CSharp NuGet to GitHub Package Registry
run: |
dotnet build -c Release
dotnet pack -c Release
nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/linksplatform/index.json" -UserName linksplatform -Password ${{ secrets.GITHUB_TOKEN }}
nuget push **/*.nupkg -Source "GitHub" -SkipDuplicate
findChangedCsFiles:
runs-on: ubuntu-latest
needs: publiseRelease
outputs:
isCsFilesChanged: steps.check_if_csharp_files_changed.outputs.findChangesCsFiles
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Check if cs files are changed
uses: tj-actions/[email protected]
id: findChangesCsFiles
with:
files: |
*.cs
generatePdfWithCsharpCode:
runs-on: ubuntu-latest
needs: [testCs, publiseRelease, findChangedCsFiles]
if: needs.findChangedCsFiles.outputs.isCsFilesChanged == 'true'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Generate PDF with CSharp code
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/format-csharp-files.py"
wget "$SCRIPTS_BASE_URL/format-csharp-document.sh"
wget "$SCRIPTS_BASE_URL/generate-csharp-pdf.sh"
bash ./generate-csharp-pdf.sh
publishCsDocumentation:
runs-on: ubuntu-latest
needs: [testCs, publiseRelease, findChangedCsFiles]
if: needs.findChangedCsFiles.outputs.isCsFilesChanged == 'true'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Publish CSharp documentation to gh-pages branch
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/docfx.json"
wget "$SCRIPTS_BASE_URL/filter.yml"
wget "$SCRIPTS_BASE_URL/toc.yml"
wget "$SCRIPTS_BASE_URL/publish-csharp-docs.sh"
bash ./publish-csharp-docs.sh