-
-
Notifications
You must be signed in to change notification settings - Fork 12
Add Windows CI (build-test-installer-release) #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
66423b3
Add Windows CI (build-test-installer-release)
megahirt 5cc01d7
what if we run all tests on CI?
megahirt 324c56f
Indentation suggestions
megahirt 09f10e6
remove infinite CI loop in media tests
megahirt 7813f18
exclude tests marked skipOnCI
megahirt 6718bf2
remove unnecessary flag
megahirt 938bc07
add saymore-docs as submodule
megahirt edf41d4
checkout submodules in workflow
megahirt 2904084
publish HTML release notes
megahirt 176802e
explicitly fetch tags
megahirt 1bfd188
try working directory
megahirt 8e2db29
pwd
megahirt 6e5f735
git describe
megahirt d79304d
fetch tags
megahirt e22dc32
Ensure workflows fetch full history for versioning
megahirt c2a324b
fix CHM filename
megahirt ed7a1cb
fold workflow into single job
megahirt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| name: Build Test Installer Release | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: | ||
| - 'v*' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
|
|
||
| env: | ||
| Configuration: Release | ||
|
|
||
| jobs: | ||
| build_test: | ||
| name: Build and test | ||
| runs-on: windows-latest | ||
| outputs: | ||
| version: ${{ steps.compute_version.outputs.version }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Compute Version | ||
| id: compute_version | ||
| shell: bash | ||
| run: | | ||
| # If this is a tag push and it starts with v, just use it and strip off the v | ||
| if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then | ||
| Version="${GITHUB_REF#refs/tags/}" | ||
| Version="${Version#v}" | ||
| echo "version=$Version" >> $GITHUB_OUTPUT | ||
| echo "detected tag push: $Version" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Otherwise find the latest tag that starts with v and strip off the v | ||
| LAST_TAG=$(git describe --tags --match "v*" --abbrev=0 2>/dev/null || echo "v0.0.0") | ||
|
|
||
| # Compute a build number based on number of commits since that tag | ||
| COMMITS_SINCE_TAG=$(git rev-list ${LAST_TAG}..HEAD --count) | ||
|
|
||
| # Final version: X.Y.Z | ||
| Version="${LAST_TAG#v}.${COMMITS_SINCE_TAG}" | ||
| echo "version=$Version" >> $GITHUB_OUTPUT | ||
| echo "no tag push; using $Version" | ||
|
|
||
| - name: Setup NuGet | ||
| uses: NuGet/setup-nuget@v2 | ||
|
|
||
| - name: Restore NuGet packages | ||
| run: nuget restore SayMore.sln | ||
|
|
||
| - name: Setup MSBuild | ||
| uses: microsoft/setup-msbuild@v2 | ||
| with: | ||
| vs-version: '[17.0,18.0)' | ||
|
|
||
| - name: Build solution | ||
| run: msbuild build\SayMore.proj /t:Build /p:Configuration=$env:Configuration /p:Version=$env:Version /m | ||
|
|
||
| - name: Run tests | ||
| run: msbuild build\SayMore.proj /t:Test /p:Configuration=$env:Configuration /p:useNUnit-x86=true /p:excludedCategories=SkipOnCI /m | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: saymore-test-results | ||
| if-no-files-found: warn | ||
| path: output/${{ env.Configuration }}/TestResults.xml | ||
|
|
||
| build_installer: | ||
| name: Build installer, sign, and publish artifacts | ||
| needs: build_test | ||
| if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))) }} | ||
| runs-on: windows-latest | ||
| env: | ||
| Version: ${{ needs.build_test.outputs.version }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup NuGet | ||
| uses: NuGet/setup-nuget@v2 | ||
|
|
||
| - name: Restore NuGet packages | ||
| run: nuget restore SayMore.sln | ||
|
|
||
| - name: Fetch documentation artifacts | ||
| shell: bash | ||
| run: build/getDependencies-windows.sh | ||
|
|
||
| - name: Setup MSBuild | ||
| uses: microsoft/setup-msbuild@v2 | ||
| with: | ||
| vs-version: '[17.0,18.0)' | ||
|
|
||
| - name: Build installer | ||
| run: msbuild build\SayMore.proj /t:Installer /p:Configuration=$env:Configuration /p:useNUnit-x86=true /p:Version=$env:Version /m | ||
|
|
||
| - name: Sign installer | ||
| if: ${{ github.event_name != 'pull_request' }} | ||
| uses: sillsdev/codesign/trusted-signing-action@v3 | ||
| with: | ||
| credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }} | ||
| files-folder: output/installer | ||
| files-folder-filter: SayMoreInstaller*.msi | ||
|
|
||
| - name: Upload installer artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: saymore-installer | ||
| if-no-files-found: error | ||
| path: | | ||
| output/installer/SayMoreInstaller*.msi | ||
| output/installer/*.download_info | ||
| output/installer/appcast.xml | ||
| output/releasenotes.download_info | ||
|
|
||
| - name: Create release | ||
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: | | ||
| output/installer/SayMoreInstaller*.msi | ||
| output/installer/*.download_info | ||
| output/installer/appcast.xml | ||
| output/releasenotes.download_info | ||
| draft: true | ||
| generate_release_notes: true | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: 'Test Report' | ||
| # This is recommended to run after the CI workflow to publish test results since it has different | ||
| # permissions | ||
| on: | ||
| workflow_run: | ||
| workflows: ['CI'] # runs after CI workflow | ||
| types: | ||
| - completed | ||
| permissions: | ||
| contents: read | ||
| actions: read | ||
| checks: write | ||
| jobs: | ||
| report: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: dorny/test-reporter@v2 | ||
| with: | ||
| artifact: saymore-test-results | ||
| name: NUnit Tests | ||
| path: '*.xml' # Path to test results (inside artifact .zip) | ||
| reporter: dotnet-nunit |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.