Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 59 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:
Solution: windows/libmysofa.sln
Configuration: Release
Artifacts: windows/bin/x64/Release

on:
push:
Branches: $Branch
Expand All @@ -14,18 +14,54 @@ on:
workflow_dispatch:

jobs:
CommitInfo:
# proudust/gh-describe@v2 might be useful, but provides neither date nor absolute count
runs-on: ubuntu-latest
outputs:
date: ${{ steps.ghd.outputs.Date }}
hash: ${{ steps.ghd.outputs.Hash }}
count: ${{ steps.ghd.outputs.Count }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Get current date, commit hash and count
id: ghd
run: |
echo "Date=$(git show -s --date=format:'%Y-%m-%d' --format=%cd)" | tee -a $GITHUB_OUTPUT
echo "Hash=$(git rev-parse --short=7 HEAD)" | tee -a $GITHUB_OUTPUT
echo "Count=$(git rev-list --count HEAD)" | tee -a $GITHUB_OUTPUT

Linux:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt-get install -y zlib1g-dev libcunit1-dev

- name: Checkout code
uses: actions/checkout@v6
with:
submodules: true

- name: Build Project
id: build
uses: threeal/cmake-action@v2.1.0
with:
build-dir: _build
- name: Run tests
run: cmake --build ${{ steps.build.outputs.build-dir }} -t test

Windows:
runs-on: windows-latest
needs:
- CommitInfo
steps:

- name: Clone repo and submodules
run: git clone --recurse-submodules https://github.com/${{github.repository}}.git . --branch ${{env.Branch}}

- name: Get current date, commit hash and count
run: |
echo "CommitDate=$(git show -s --date=format:'%Y-%m-%d' --format=%cd)" >> $env:GITHUB_ENV
echo "CommitHashShort=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV
echo "CommitCount=$(git rev-list --count HEAD)" >> $env:GITHUB_ENV
uses: actions/checkout@v6
with:
submodules: true

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
Expand All @@ -37,14 +73,24 @@ jobs:
- name: Upload Installer Artifact to GitHub
uses: actions/upload-artifact@v4
with:
name: "${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}}"
path: "${{github.workspace}}/${{env.Artifacts}}/"
name: "${{github.event.repository.name}}_r${{needs.CommitInfo.outputs.count}}@${{needs.CommitInfo.outputs.hash}}"
path: "${{ github.workspace }}/${{ env.Artifacts }}/"

PreRelease:
runs-on: ubuntu-latest
needs:
- CommitInfo
- Windows
- Linux
steps:
- name: Fetch artifacts
uses: actions/download-artifact@v5

- name: GitHub pre-release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{secrets.GITHUB_TOKEN}}"
automatic_release_tag: "latest"
prerelease: true
title: "[${{env.CommitDate}}] ${{github.event.repository.name}} r${{env.CommitCount}}@${{env.CommitHashShort}}"
files: "${{env.Artifacts}}/*"
title: "[${{needs.CommitInfo.outputs.date}}] ${{github.event.repository.name}} r${{needs.CommitInfo.outputs.count}}@${{needs.CommitInfo.outputs.hash}}"
files: "*"
Loading