Skip to content

Import 1.5-style pacts #1155

Import 1.5-style pacts

Import 1.5-style pacts #1155

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: "Cloning repo"
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- 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/semantic-version@v5.3.0
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 = "Chen"' | out-file data/version.txt -encoding ASCII -append
echo 'source = "Vic3"' | out-file data/version.txt -encoding ASCII -append
echo 'minSource = "1.3"' | out-file data/version.txt -encoding ASCII -append
echo 'maxSource = "1.5"' | out-file data/version.txt -encoding ASCII -append
echo 'target = "HoI4"' | out-file data/version.txt -encoding ASCII -append
echo 'minTarget = "1.13"' | out-file data/version.txt -encoding ASCII -append
echo 'maxTarget = "1.13"' | out-file data/version.txt -encoding ASCII -append
cat data/version.txt
- name: "Build solution"
run: |
cd "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\"
.\MSBuild.exe -m -p:Configuration=Release $Env:GITHUB_WORKSPACE\Vic3ToHoi4.sln
- name: "Run tests"
run: |
cd $Env:GITHUB_WORKSPACE\build\test\Release
.\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\*
.\7z.exe a $Env:GITHUB_WORKSPACE\Vic3ToHoI4-latest-win-x64.zip $Env:GITHUB_WORKSPACE\build\Release\*
- 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\*
- 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: true
- 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: "Build solution"
run: |
cd "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\"
.\MSBuild.exe -m -p:Configuration=Release $Env:GITHUB_WORKSPACE\Vic3ToHoI4.sln
- name: "Run tests"
run: |
cd $Env:GITHUB_WORKSPACE\build\test\Release
.\Vic3ToHoI4Tests.exe
- name: "Cleanup"
if: always()
run: |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse