Always calculate Docker tags, even if not pushing #8
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: dotnet-build | |
on: | |
push: | |
branches: [ develop, master, chore/dotnet-build-in-ci ] | |
# TODO: Remove chore/dotnet-build-in-ci 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 | |
ls -lR | |
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 }} |