Skip to content

main

main #4080

Workflow file for this run

---
name: main
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 6 * * *"
defaults:
run:
shell: bash
env:
# Misc.
CI_SKIP_WIN_SERVICES: 1
# dotnet
rdmp-cli-dir: "./rdmp-cli"
db-password: "YourStrongPassw0rd"
# java
java-version: 11
java-distribution: temurin
# python
python-version: 3.6
jobs:
init:
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
build_ref: ${{ steps.build_ref.outputs.build_ref }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: set matrix
id: matrix
run: |
set -euxo pipefail
matrix="$(jq --compact-output . .github/workflows/envs.json)"
echo $matrix
echo "matrix=$matrix" >> $GITHUB_OUTPUT
- name: set build ref
id: build_ref
run: |
set -euxo pipefail
build_ref="$GITHUB_REF_NAME"
[ "$GITHUB_REF_TYPE" != "tag" ] && build_ref="${GITHUB_SHA:0:6}"
echo "build_ref=$build_ref" >> $GITHUB_OUTPUT
smi:
needs: [init]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.init.outputs.matrix) }}
runs-on: ${{ matrix.image }}
steps:
- name: "[linux] enable disk caching"
if: ${{ matrix.os == 'linux' }}
run: sudo apt-get install -y libeatmydata1
- name: checkout
uses: actions/checkout@v4
- name: setup .NET
# NOTE(rkm 2022-02-20) Uses global.json
uses: actions/setup-dotnet@v4.0.0
- name: download tessdata
run: ./bin/smi/downloadTessdata.py
- name: "[linux] start services"
if: ${{ matrix.os == 'linux' }}
run: ./bin/smi/startDockerLinux.py ${{ env.db-password }}
- name: "[linux] re-write database strings"
if: ${{ matrix.os == 'linux' }}
run: |
set -euxo pipefail
echo "rdmp_conn_str=localhost -u sa -p ${{ env.db-password }}" >> $GITHUB_ENV
./bin/smi/writeDatabaseStrings.py localhost "${{ env.db-password }}"
- name: "[linux] set RDMP version"
if: ${{ matrix.os == 'linux' }}
run: |
set -euxo pipefail
rdmp_cli_ver=$(grep -F -m1 HIC.RDMP.Plugin Directory.Packages.props | sed -n 's/.*Version="\([0-9.]*\)".*/\1/p')
echo "rdmp_cli_ver=$rdmp_cli_ver" >> $GITHUB_ENV
- name: "[linux] download rdmp-cli"
if: ${{ matrix.os == 'linux' }}
run: |
curl -L https://github.com/HicServices/RDMP/releases/download/v${{ env.rdmp_cli_ver }}/rdmp-${{ env.rdmp_cli_ver }}-cli-linux-x64.tar.xz | tar xJf -
mv rdmp-${{ env.rdmp_cli_ver }}-cli-linux rdmp-cli
- name: "[linux] install RDMP databases"
if: ${{ matrix.os == 'linux' }}
run: ${{ env.rdmp-cli-dir }}/rdmp install --createdatabasetimeout 180 ${{ env.rdmp_conn_str }} TEST_
- name: show dotnet info
run: dotnet --info
- name: build, test, and package dotnet
run: |
set -euxo pipefail
cov=""
[ "${{ matrix.os }}" == "windows" ] && cov="--no-coverage"
./bin/smi/buildTestPackage.py \
${{ needs.init.outputs.build_ref }} \
"$cov"
- name: upload coverage
if: ${{ matrix.os == 'linux' }}
uses: codecov/codecov-action@v4.4.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage.cobertura.xml
fail_ci_if_error: true
- name: upload dist
uses: actions/upload-artifact@v4
with:
name: SmiServices-${{ needs.init.outputs.build_ref }}-smi-${{ matrix.os }}.zip
path: dist/${{ needs.init.outputs.build_ref }}/*
if-no-files-found: error
ctp:
needs: [init]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.init.outputs.matrix) }}
runs-on: ${{ matrix.image }}
steps:
- name: "[linux] enable disk caching"
if: ${{ matrix.os == 'linux' }}
run: sudo apt-get install -y libeatmydata1
- name: checkout
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4.2.1
with:
java-version: ${{ env.java-version }}
distribution: ${{ env.java-distribution }}
cache: maven
- name: "[linux] start services"
if: ${{ matrix.os == 'linux' }}
run: ./bin/ctp/startDockerLinux.py
- name: "[windows] skip integration tests"
if: ${{ matrix.os == 'windows' }}
run: echo "JAVA_TESTS=--skip-integration-tests" >> $GITHUB_ENV
- name: build, test, and package ctp
run: ./bin/ctp/buildTestPackage.py --install-libs ${{ needs.init.outputs.build_ref }} ${{ env.JAVA_TESTS }}
- name: "[linux] upload packages"
if: ${{ matrix.os == 'linux' }}
uses: actions/upload-artifact@v4
with:
name: SmiServices-${{ needs.init.outputs.build_ref }}-ctp.zip
path: dist/${{ needs.init.outputs.build_ref }}/*
if-no-files-found: error
upload-to-release:
if: contains(github.ref, 'refs/tags/v')
needs: [init, smi, ctp]
runs-on: ubuntu-20.04
steps:
- name: "[linux] enable disk caching"
run: sudo apt-get install -y libeatmydata1
- name: checkout
uses: actions/checkout@v4
- name: download artifacts
uses: actions/download-artifact@v4
with:
path: ./dist
- name: prepare artifacts for release
run: |
set -euxo pipefail
dist_dir=./dist
[ ! -d "$dist_dir" ] && { echo "No artifacts downloaded"; exit 1; }
mkdir ./release
sed -i 's/\r$//' $dist_dir/*/MD5SUM*
cat $dist_dir/*/MD5SUM* >> ./release/MD5SUMS.txt
rm $dist_dir/*/MD5SUM*
cp $dist_dir/*/* ./release/
cd ./release
md5sum -c MD5SUMS.txt
cd ..
./bin/release/createReleaseChangelog.py ${{ needs.init.outputs.build_ref }}
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: ./release/*
body_path: release_changelog.md
fail_on_unmatched_files: true
generate_release_notes: true