-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New GHA workflow for simpler dotnet build
This workflow uses `dotnet test` and `dotnet build` steps directly in the GHA runner, rather than building an LfMerge builder image. That way it's a lot easier to understand the build process, and to replicate it on dev machines (just do `dotnet build` and `dotnet test`).
- Loading branch information
Showing
9 changed files
with
162 additions
and
148 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: dotnet-build | ||
|
||
on: | ||
push: | ||
branches: [ develop, master, update-mercurial-version ] | ||
# TODO: Remove update-mercurial-version once testing is complete | ||
pull_request: | ||
branches: [ develop ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
# We won't use ubuntu-latest so that we can control when to switch to the ubuntu-24.04 runner once it comes out | ||
runs-on: ubuntu-22.04 | ||
|
||
# As of 2022-08-16, we build LfMerge for LCM DB version 72 only (and will expand this to include any future DbVersions) | ||
strategy: | ||
matrix: | ||
dbversion: [7000072] | ||
|
||
steps: | ||
- name: Check out current branch | ||
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0 | ||
with: | ||
fetch-depth: 0 # All history for all tags and branches, since version number script needs that | ||
|
||
- name: Calculate version number | ||
id: version | ||
env: | ||
BUILD_NUMBER: ${{ github.run_number }} | ||
DbVersion: ${{ matrix.dbversion }} | ||
run: docker/scripts/get-version-number.sh | ||
|
||
- name: Save current version number to an output | ||
id: output_version_number | ||
run: | | ||
echo Will tag ${{matrix.dbversion}} with ${TAG} | ||
echo "TagFor${{matrix.dbversion}}=${TAG}" >> $GITHUB_OUTPUT | ||
echo "VersionFor${{matrix.dbversion}}=${VERSION}" >> $GITHUB_OUTPUT | ||
env: | ||
TAG: v${{ steps.version.outputs.MsBuildVersion }} | ||
VERSION: ${{ steps.version.outputs.MsBuildVersion }} | ||
|
||
- name: Set up buildx for Docker | ||
uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0 | ||
|
||
- name: Find current UID and GID | ||
id: uid | ||
run: | | ||
echo "uid=$(id -u)" >> $GITHUB_OUTPUT | ||
echo "gid=$(id -g)" >> $GITHUB_OUTPUT | ||
- name: dotnet build | ||
run: dotnet build /property:Configuration=Release /property:DatabaseVersion=${DbVersion} LfMerge.sln | ||
env: | ||
BUILD_NUMBER: ${{ github.run_number }} | ||
DbVersion: ${{ matrix.dbversion }} | ||
DebPackageVersion: ${{ steps.version.outputs.DebPackageVersion }} | ||
MsBuildVersion: ${{ steps.version.outputs.MsBuildVersion }} | ||
MajorMinorPatch: ${{ steps.version.outputs.MajorMinorPatch }} | ||
AssemblySemVer: ${{ steps.version.outputs.AssemblySemVer }} | ||
AssemblySemFileVer: ${{ steps.version.outputs.AssemblySemFileVer }} | ||
InformationalVersion: ${{ steps.version.outputs.InformationalVersion }} | ||
|
||
- name: Set up required directories for dotnet test | ||
run: | | ||
sudo mkdir -p /usr/lib/lfmerge/${DbVersion} /var/lib/languageforge/lexicon/sendreceive/{Templates,state,editqueue,syncqueue,webwork} | ||
sudo chown -R ${uid}:${gid} /usr/lib/lfmerge /var/lib/languageforge/lexicon/sendreceive | ||
env: | ||
DbVersion: ${{ matrix.dbversion }} | ||
uid: ${{ steps.uid.outputs.uid }} | ||
gid: ${{ steps.uid.outputs.gid }} | ||
|
||
- name: dotnet test | ||
run: | | ||
source environ | ||
dotnet test -l:"console;verbosity=normal" -l:nunit -c Release | ||
env: | ||
BUILD_NUMBER: ${{ github.run_number }} | ||
DbVersion: ${{ matrix.dbversion }} | ||
VSTEST_TESTHOST_SHUTDOWN_TIMEOUT: "30000" | ||
DebPackageVersion: ${{ steps.version.outputs.DebPackageVersion }} | ||
MsBuildVersion: ${{ steps.version.outputs.MsBuildVersion }} | ||
MajorMinorPatch: ${{ steps.version.outputs.MajorMinorPatch }} | ||
AssemblySemVer: ${{ steps.version.outputs.AssemblySemVer }} | ||
AssemblySemFileVer: ${{ steps.version.outputs.AssemblySemFileVer }} | ||
InformationalVersion: ${{ steps.version.outputs.InformationalVersion }} | ||
|
||
- name: Report test results | ||
uses: EnricoMi/[email protected] | ||
if: always() | ||
with: | ||
nunit_files: "**/TestResults/TestResults.xml" | ||
|
||
- name: Prepare build output for installation tarball | ||
run: docker/scripts/create-installation-tarball.sh ${DbVersion} | ||
env: | ||
DbVersion: ${{ matrix.dbversion }} | ||
|
||
# TODO: Test if this is still needed with upload-artifact@v4. Does GitHub now create tarballs that preserve Unix file permissions? If so, we can eliminate this step. | ||
- name: Compress tarball images for faster uploads | ||
run: time (tar cf - tarball | gzip -c > tarball.tar.gz) | ||
|
||
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | ||
with: | ||
name: lfmerge-tarball-${{ matrix.dbversion }} | ||
path: tarball.tar.gz | ||
compression-level: 0 # Already compressed in previous step. If we ever remove the previous step, we should remove this line also | ||
outputs: | ||
MsBuildVersion: ${{ steps.output_version_number.outputs.VersionFor7000072 }} | ||
TagFor7000072: ${{ steps.output_version_number.outputs.TagFor7000072 }} | ||
|
||
release: | ||
needs: build | ||
uses: ./.github/workflows/release.yml | ||
with: | ||
MsBuildVersion: ${{ needs.build.outputs.MsBuildVersion }} | ||
TagFor7000072: ${{ needs.build.outputs.TagFor7000072 }} |
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
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
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
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
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
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
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