Skip to content

Build release VC

Build release VC #181

# 2024-09-02 00:40
# soft_fast_search patch
name: Build release VC
on:
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
workflow_dispatch:
inputs:
extra_plugins_profile:
default: true
type: boolean
code-style-checks:
default: true
type: boolean
hlf-checks:
default: true
type: boolean
msbuild_cl_x64_release_input:
default: true
type: boolean
msbuild_cl_x86_release_input:
default: true
type: boolean
msbuild_cl_ARM64_release_input:
default: true
type: boolean
soft_fast_search_patch:
default: true
type: boolean
env:
PROG_NAME: "Far3"
TAG_NAME: "Far3"
Far_version: "3.0."
jobs:
#------------------------------------------------------------------------------
code-style-checks:
runs-on: ubuntu-latest
if: ${{ inputs.code-style-checks }}
steps:
- name: Checkout source
uses: deep-soft/checkout@v4
- name: Setup Python
uses: deep-soft/setup-python@v5
- name: Run checks
working-directory: far
run: python tools/source_validator.py
#------------------------------------------------------------------------------
hlf-checks:
runs-on: windows-2022
if: ${{ inputs.hlf-checks }}
steps:
- name: Checkout source
uses: deep-soft/checkout@v4
- uses: deep-soft/setup-dotnet@v4
with:
dotnet-version: '6.0'
- name: Build and run ChangelogChecker
working-directory: misc/build-checks/ChangelogChecker
run: dotnet run --project ./ChangelogChecker.csproj --configuration Release --property UseSharedCompilation=false
- name: Build and run HlfChecker
working-directory: misc/build-checks/HlfChecker
run: dotnet run --project ./HlfChecker.csproj --configuration Release --property UseSharedCompilation=false -- Verbose
#------------------------------------------------------------------------------
build-msbuild:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
build: [
msbuild_cl_x64_release,
msbuild_cl_x86_release,
msbuild_cl_ARM64_release,
# msbuild_cl_x64_debug,
# msbuild_cl_x86_debug,
]
include:
- { build: msbuild_cl_x64_release, compiler: msbuild_cl, arch: amd64, platform_sln: x64, platform_name: x64, build_config: Release }
- { build: msbuild_cl_x86_release, compiler: msbuild_cl, arch: amd64_x86, platform_sln: Win32, platform_name: x86, build_config: Release }
- { build: msbuild_cl_ARM64_release, compiler: msbuild_cl, arch: amd64_arm64, platform_sln: ARM64, platform_name: ARM64, build_config: Release }
# - { build: msbuild_cl_x64_debug, compiler: msbuild_cl, arch: amd64, platform_sln: x64, platform_name: x64, build_config: Debug }
# - { build: msbuild_cl_x86_debug, compiler: msbuild_cl, arch: amd64_x86, platform_sln: Win32, platform_name: x86, build_config: Debug }
# exclude:
# - { build: msbuild_cl_x64_release }: ${{ inputs.msbuild_cl_x64_release_input != true }}
# - { build: msbuild_cl_x86_release }: ${{ inputs.msbuild_cl_x86_release_input != true }}
# - { build: msbuild_cl_ARM64_release }: ${{ inputs.msbuild_cl_ARM64_release_input != true }}
steps:
- name: test var
if: always() && inputs.extra_plugins_profile && matrix.platform_sln == 'x64'
run: |
echo " if: always() && inputs.extra_plugins_profile && matrix.platform_sln == 'x64'"
- name: Checkout source
uses: deep-soft/checkout@v4
- name: soft_fast_search_patch
if: ${{ inputs.soft_fast_search_patch }}
continue-on-error: true
shell: bash
run: |
ls -la patch/filelist.diff || true;
if [[ -f patch/filelist.diff ]]; then
git apply --verbose patch/filelist.diff
fi
- name: Get program version
continue-on-error: false
shell: bash
run: |
Far_version=${{ env.Far_Version}}
Far_build=$(cat "far/vbuild.m4")
echo $Far_version$Far_build
echo "VERSION=$Far_version$Far_build.0" >> $GITHUB_ENV
- name: Print program version
continue-on-error: false
shell: bash
run: |
echo "Print program version"
echo ${{ env.VERSION }}
- name: Initialize CodeQL
if: matrix.build == 'msbuild_cl_x64_debug'
uses: github/codeql-action/init@v2
with:
languages: cpp
- name: Set MSVC environment
uses: deep-soft/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Set environment for debug build
if: matrix.build_config == 'Debug'
run: |
Add-Content -Path $env:GITHUB_ENV -Value "DEBUG=1"
- name: Build (cl)
working-directory: _build/vc
run: |
msbuild -m /property:Configuration=${{ matrix.build_config }} /property:Platform=${{ matrix.platform_sln }} all.sln
- name: Perform CodeQL Analysis
if: matrix.build == 'msbuild_cl_x64_debug'
uses: github/codeql-action/analyze@v2
# - name: Create zip
# continue-on-error: true
# working-directory: _build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}
# run: |
# dir ./
# Compress-Archive . ../${{ env.PROG_NAME }}.${{ matrix.build_config }}.${{ matrix.platform_sln }}.${{ env.VERSION }}.zip
# dir ../
- name: Add extra plugins NetBox and Colorer
continue-on-error: true
shell: bash
run: |
pushd '_build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}/Plugins'
for extra_plug in Far-NetBox Far-Colorer ; do
mkdir $extra_plug
cd $extra_plug
curl -LOJ "https://github.com/deep-soft/$extra_plug/releases/download/$extra_plug-latest/$extra_plug.${{ matrix.platform_name }}.7z"
7z x $extra_plug.${{ matrix.platform_name }}.7z
rm $extra_plug.${{ matrix.platform_name }}.7z
cd ..
done
popd
- name: Sign Windows exe and dll files
continue-on-error: true
uses: deep-soft/code-sign-action@v9
with:
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}'
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}'
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.CERTNAME }}'
folder: '_build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}'
recursive: true
- name: Create Zip Archive Release
if: matrix.build_config == 'Release'
uses: deep-soft/zip-release@v2
with:
type: 'zip'
filename: '${{ env.PROG_NAME }}.${{ matrix.platform_sln }}.${{ env.VERSION }}.zip'
directory: '_build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}'
exclusions: '*.map *.pdb'
recursive_exclusions: '*.map *.pdb changelog *Bel.lng *Cze.lng *Ger.lng *Hun.lng *Ita.lng *Lit.lng *Pol.lng *Rus.lng *Sky.lng *Spa.lng *Ukr* *Bel.hlf *Cze.hlf *Ger.hlf *Hun.hlf *Ita.hlf *Lit.hlf *Pol.hlf *Rus.hlf *Sky.hlf *Spa.hlf *Ukr*'
path: '.'
- name: Upload zip
if: matrix.build_config == 'Release'
continue-on-error: true
uses: deep-soft/upload-artifact@v4
with:
name: ${{ env.PROG_NAME }}.${{ matrix.platform_name }}.${{ env.VERSION }}.zip
#path: _build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}/${{ env.PROG_NAME }}.${{ matrix.build_config }}.${{ matrix.platform_sln }}.${{ env.VERSION }}.zip
path: ${{ env.ZIP_RELEASE_ARCHIVE }}
- name: Upload folder
if: matrix.build_config == 'Debug'
continue-on-error: true
uses: deep-soft/upload-artifact@v4
with:
name: ${{ env.PROG_NAME }}.${{ matrix.build_config }}.${{ matrix.platform_name }}
path: _build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}
# - name: Create list file
# continue-on-error: true
# shell: bash
# run: |
# list_file="${{ env.PROG_NAME }}.${{ matrix.build }}-${{ matrix.compiler }}-${{ matrix.arch }}-${{ matrix.platform_sln }}-${{ matrix.platform_name }}-${{ matrix.build_config }}.txt"
# ls -lR > $list_file
# echo "LIST_File=$list_file" >> $GITHUB_ENV
- name: Publish
if: matrix.build_config == 'Release'
continue-on-error: true
uses: deep-soft/[email protected]
with:
tag_name: ${{ env.TAG_NAME }}-${{ env.VERSION }}
# files: |
# ${{ env.LIST_File }}
files: |
${{ env.ZIP_RELEASE_ARCHIVE }}
- name: Prepare latest Release
if: matrix.build_config == 'Release'
continue-on-error: false
shell: bash
run: |
mv ${{ env.ZIP_RELEASE_ARCHIVE }} ${{ env.PROG_NAME }}.${{ matrix.platform_name }}.zip
echo "${{ env.VERSION }}" > ${{ env.PROG_NAME }}-latest.txt
- name: Publish latest Release
if: matrix.build_config == 'Release'
continue-on-error: false
uses: deep-soft/[email protected]
with:
draft: false
tag_name: ${{ env.PROG_NAME }}-latest
body: "${{ env.PROG_NAME }} latest: v${{ env.VERSION }}"
files: |
${{ env.PROG_NAME }}.${{ matrix.platform_name }}.zip
${{ env.PROG_NAME }}-latest.txt
# add extra plugins and Profile - begin
# if: ${{ matrix.platform_sln == 'x64' && inputs.extra_plugins_profile == 'true' }}
# if: ${{ inputs.extra_plugins_profile }} && ${{ matrix.platform_sln == 'x64' }}
- name: extra - Add plugins and Profile
if: always() && inputs.extra_plugins_profile && matrix.platform_sln == 'x64'
continue-on-error: true
shell: bash
run: |
pushd '_build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}'
curl -LOJ "https://github.com/deep-soft/DS-Progs/raw/main/bin/Far3-Plugins-Extra.zip"
curl -LOJ "https://github.com/deep-soft/DS-Progs/raw/main/bin/Far3-Profile.zip"
7z x Far3-Plugins-Extra.zip
7z x Far3-Profile.zip
rm Far3-Plugins-Extra.zip
rm Far3-Profile.zip
popd
- name: extra - Sign Windows exe and dll files
if: always() && inputs.extra_plugins_profile && matrix.platform_sln == 'x64'
continue-on-error: true
uses: deep-soft/code-sign-action@v9
with:
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}'
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}'
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.CERTNAME }}'
folder: '_build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}'
recursive: true
- name: extra - Create Zip Archive Release
if: always() && inputs.extra_plugins_profile && matrix.platform_sln == 'x64'
uses: deep-soft/zip-release@v2
with:
type: 'zip'
filename: '${{ env.PROG_NAME }}.${{ matrix.platform_sln }}.${{ env.VERSION }}-extra.zip'
directory: '_build/vc/_output/product/${{ matrix.build_config }}.${{ matrix.platform_sln }}'
exclusions: '*.map *.pdb'
recursive_exclusions: '*.map *.pdb changelog *Bel.lng *Cze.lng *Ger.lng *Hun.lng *Ita.lng *Lit.lng *Pol.lng *Rus.lng *Sky.lng *Spa.lng *Ukr* *Bel.hlf *Cze.hlf *Ger.hlf *Hun.hlf *Ita.hlf *Lit.hlf *Pol.hlf *Rus.hlf *Sky.hlf *Spa.hlf *Ukr*'
path: '.'
- name: extra - Publish
if: always() && inputs.extra_plugins_profile && matrix.platform_sln == 'x64'
continue-on-error: true
uses: deep-soft/[email protected]
with:
tag_name: ${{ env.TAG_NAME }}-${{ env.VERSION }}
files: |
${{ env.ZIP_RELEASE_ARCHIVE }}
- name: extra - Prepare latest Release
if: always() && inputs.extra_plugins_profile && matrix.platform_sln == 'x64'
continue-on-error: false
shell: bash
run: |
mv ${{ env.ZIP_RELEASE_ARCHIVE }} ${{ env.PROG_NAME }}.${{ matrix.platform_name }}-extra.zip
echo "${{ env.VERSION }}" > ${{ env.PROG_NAME }}-extra-latest.txt
- name: extra - Publish latest Release
if: always() && inputs.extra_plugins_profile && matrix.platform_sln == 'x64'
continue-on-error: false
uses: deep-soft/[email protected]
with:
draft: false
tag_name: ${{ env.PROG_NAME }}-latest
body: "${{ env.PROG_NAME }} latest: v${{ env.VERSION }}"
files: |
${{ env.PROG_NAME }}.${{ matrix.platform_name }}-extra.zip
${{ env.PROG_NAME }}-extra-latest.txt
# add extra plugins and Profile - end