Stories decisions #1477
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, test and publish | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_test_and_publish: | |
name: Build, test and publish local | |
if: github.repository_owner == 'ParadoxGameConverters' | |
runs-on: [self-hosted, windows] | |
steps: | |
- name: work around permission issue | |
run: git config --global --add safe.directory /github/workspace | |
- name: Add Ninja build to PATH | |
run: echo "c:\program files\ninja" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: "Cloning repo" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: "Cloning selective submodules" | |
run: | | |
git submodule update --init --recursive external\commonItems | |
git -c submodule."external/commonItems".update=none ` | |
submodule update --init --recursive external\Fronter | |
- name: "Fetching tags" | |
run: | | |
git fetch --tags | |
git tag | |
- name: "Generate semantic version number" | |
uses: paulhatch/[email protected] | |
id: version_number | |
with: | |
# The prefix to use to identify tags | |
tag_prefix: "" | |
# A string which, if present in a git commit, indicates that a change represents a | |
# major (breaking) change, supports regular expressions wrapped with '/' | |
major_pattern: "(MAJOR)" | |
# A string which indicates the flags used by the `major_pattern` regular expression. Supported flags: idgs | |
major_regexp_flags: "" | |
# Same as above except indicating a minor change, supports regular expressions wrapped with '/' | |
minor_pattern: "(MINOR)" | |
# A string which indicates the flags used by the `minor_pattern` regular expression. Supported flags: idgs | |
minor_regexp_flags: "" | |
# A string to determine the format of the version output | |
version_format: "v${major}.${minor}.${patch}" | |
# If this is set to true, *every* commit will be treated as a new version. | |
bump_each_commit: true | |
# If true, the body of commits will also be searched for major/minor patterns to determine the version type. | |
search_commit_body: false | |
# The output method used to generate list of users, 'csv' or 'json'. | |
user_format_type: "csv" | |
- name: "Echo version number" | |
run: | | |
echo ${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}.${{ steps.version_number.outputs.patch }} | |
- name: "Create version file" | |
run: | | |
echo '# Version info' | out-file data/version.txt -encoding ASCII | |
echo '' | out-file data/version.txt -encoding ASCII -append | |
echo 'version = "${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}.${{ steps.version_number.outputs.patch }}"' | out-file data/version.txt -encoding ASCII -append | |
echo 'name = "Fioravanzo"' | out-file data/version.txt -encoding ASCII -append | |
echo 'source = "Vic3"' | out-file data/version.txt -encoding ASCII -append | |
echo 'minSource = "1.8"' | out-file data/version.txt -encoding ASCII -append | |
echo 'maxSource = "1.8"' | out-file data/version.txt -encoding ASCII -append | |
echo 'target = "HoI4"' | out-file data/version.txt -encoding ASCII -append | |
echo 'minTarget = "1.15"' | out-file data/version.txt -encoding ASCII -append | |
echo 'maxTarget = "1.15"' | out-file data/version.txt -encoding ASCII -append | |
cat data/version.txt | |
- name: Build with cmake | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" | |
cmake --preset x64-release-windows | |
cmake --build --preset build-x64-release-windows --target Vic3ToHoi4 ConverterFrontend Vic3ToHoi4Tests -- -j40 | |
- name: "Run tests" | |
run: | | |
cd $Env:GITHUB_WORKSPACE\build\test\Release-Windows | |
.\Vic3ToHoI4Tests.exe | |
- name: "Prepare release" | |
run: | | |
cd "C:\Program Files\7-Zip\" | |
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release-Windows\* | |
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-latest-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release-Windows\* | |
- name: "Prepare installer" | |
run: | | |
c:\"Program Files (x86)\Inno Setup 6\iscc" Vic3ToHoI4-Installer.iss | |
cp $Env:GITHUB_WORKSPACE\Output\Vic3ToHoI4-latest-win-x64.exe $Env:GITHUB_WORKSPACE\Output\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.exe | |
- name: "Upload binaries to named release" | |
if: ${{ github.event_name == 'push' }} | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}.0 | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
omitNameDuringUpdate: true | |
artifacts: Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.zip, Output\Vic3ToHoI4-${{ steps.version_number.outputs.major }}.${{ steps.version_number.outputs.minor }}-win-x64.exe | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- name: "Upload binaries to latest release" | |
if: ${{ github.event_name == 'push' }} | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: latest | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
omitNameDuringUpdate: true | |
artifacts: Vic3ToHoI4-latest-win-x64.zip, Output\Vic3ToHoI4-latest-win-x64.exe | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- name: "Prepare pull request artifact" | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
cd "C:\Program Files\7-Zip\" | |
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-pull-request-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release-Windows\* | |
- uses: actions/upload-artifact@v4 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
name: pull-request-version | |
path: Vic3ToHoI4-pull-request-win-x64.zip | |
- name: "Cleanup" | |
if: always() | |
run: | | |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse | |
build_test: | |
name: Build and test foreign | |
if: github.repository_owner != 'ParadoxGameConverters' | |
runs-on: windows-2022 | |
steps: | |
- name: "Cloning repo" | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: "Cloning selective submodules" | |
run: | | |
git submodule update --init --recursive external\commonItems | |
git -c submodule."external/commonItems".update=none ` | |
submodule update --init --recursive external\Fronter | |
- name: Install ninja | |
run: | | |
choco install ninja | |
- name: Build with cmake | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
cmake --preset x64-release-windows | |
cmake --build --preset build-x64-release-windows --target Vic3ToHoi4 ConverterFrontend Vic3ToHoi4Tests -- -j40 | |
- name: "Run tests" | |
run: | | |
cd $Env:GITHUB_WORKSPACE\build\test\Release-Windows | |
.\Vic3ToHoI4Tests.exe | |
- name: "Cleanup" | |
if: always() | |
run: | | |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse |