Skip to content

Use real MongoDB connection for E2E tests (#348) #96

Use real MongoDB connection for E2E tests (#348)

Use real MongoDB connection for E2E tests (#348) #96

Workflow file for this run

name: dotnet-build
on:
push:
branches: [ develop, master ]
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: 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/publish-unit-test-result-action@v2.3.0
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 }}
# actions/upload-artifact creates .zip files which do not preserve Unix file permissions, so we need to create a tarball
- 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
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 }}