better https://github.com/actions/upload-artifact/issues/506 BWA #3981
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
# | |
# Docs on github action files: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
# | |
# build-N-test | |
# | |
name: build-N-test | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
run_all: | |
description: "run all" | |
required: false | |
default: "true" | |
container_version: | |
description: "Container Version" | |
required: false | |
default: "v3" | |
jobs: | |
LinuxMatrixPrep: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- id: set-matrix | |
run: | | |
branchName=$(echo '${{ github.ref }}' | sed 's,refs/heads/,,g') | |
matrix=$(jq --arg branchName "$branchName" 'map( | |
. | select((.run_on_branch==$branchName) or (.run_on_branch=="always") or ("${{github.event.inputs.run_all}}"=="true") and (.run_on_branch!="never")) | select(.build_job=="Linux") | |
)' .github/workflows/build-N-test-Matrix.json) | |
echo "matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT | |
MacOSMatrixPrep: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- id: set-matrix | |
run: | | |
branchName=$(echo '${{ github.ref }}' | sed 's,refs/heads/,,g') | |
matrix=$(jq --arg branchName "$branchName" 'map( | |
. | select((.run_on_branch==$branchName) or (.run_on_branch=="always") or ("${{github.event.inputs.run_all}}"=="true")) | select(.build_job=="MacOS") | |
)' .github/workflows/build-N-test-Matrix.json) | |
echo "matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT | |
WindowsMatrixPrep: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- id: set-matrix | |
run: | | |
branchName=$(echo '${{ github.ref }}' | sed 's,refs/heads/,,g') | |
matrix=$(jq --arg branchName "$branchName" 'map( | |
. | select((.run_on_branch==$branchName) or (.run_on_branch=="always") or ("${{github.event.inputs.run_all}}"=="true")) | select(.build_job=="Windows") | |
)' .github/workflows/build-N-test-Matrix.json) | |
echo "matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT | |
Linux: | |
needs: LinuxMatrixPrep | |
runs-on: ${{ matrix.runs_on }} | |
strategy: | |
matrix: ${{fromJson(needs.LinuxMatrixPrep.outputs.matrix)}} | |
env: | |
# vm has 2 virtual CPUs, but 8GB ram, so jobs=3 (empirical), and QUICK_BUILD avoids some internal testing | |
MAKEFLAGS: "--jobs=3 QUICK_BUILD=1" | |
container: ${{ matrix.container_image }}:${{github.event.inputs.container_version || 'v3'}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build System Info (container version ${{github.event.inputs.container_version || 'v3'}}) | |
run: | | |
lsb_release -d 2>/dev/null || true | |
echo "CWD=" `pwd` | |
echo "nproc=" `nproc` | |
grep "model name" /proc/cpuinfo | head -1 | |
grep processor /proc/cpuinfo | wc -l | |
grep MemTotal /proc/meminfo | |
df -h | |
- name: Hacks 2 Save Space | |
run: | | |
echo ""*************Before cleanups"*************:" | |
df -h | |
#du -hs /* || true | |
#du -hs /usr/* || true | |
#du -hs /usr/share/* || true | |
#du -hs /__w/* || true | |
du -hs /usr/share/doc /usr/share/doc-base /usr/share/icons /usr/share/javascript /usr/share/fonts /usr/share/fonts-droid-fallback /usr/share/poppler /usr/share/vim /usr/share/X11 || true | |
du -hs Archive .git | |
echo Deleting: | |
rm -r /usr/share/doc /usr/share/doc-base /usr/share/icons /usr/share/javascript /usr/share/fonts /usr/share/fonts-droid-fallback /usr/share/poppler /usr/share/vim /usr/share/X11 || echo "Issue deleting incomplete" | |
rm -rf Archive .git || echo "Issue deleting incomplete" | |
#ls -la . | |
echo ""*************After cleanups"*************:" | |
df -h | |
du -hs /usr/* /usr/share/* /usr/lib/* || true | |
- name: Configure ${{ matrix.config_name }} | |
run: | | |
./configure ${{ matrix.config_name }} --compiler-driver ${{ matrix.compiler }} ${{ matrix.extra_config_args }} --cppstd-version ${{ matrix.cpp_version }} | |
cat ConfigurationFiles/${{ matrix.config_name }}.xml | |
# Break out third-party-components to do clean so we dont run out of disk space, and break out TPC AND library | |
# to show the summary time for each part | |
- name: Make third-party-components | |
run: | | |
make third-party-components | |
make clean | |
- name: Make libraries | |
run: | | |
make libraries | |
- name: Save space | |
run: | | |
echo "*************Before save space*************:" | |
df -h | |
du -hs Builds/*/* IntermediateFiles/*/* ThirdPartyComponents/Origs-Cache/ | |
make --directory Library --silent clean | |
make --directory ThirdPartyComponents --silent clean | |
rm -f Builds/${{ matrix.config_name }}/ThirdPartyComponents/bin/* ThirdPartyComponents/Origs-Cache/* | |
echo ""*************After cleanups"*************:" | |
df -h | |
du -hs Builds/*/* IntermediateFiles/*/* ThirdPartyComponents/* | |
- name: Run Tests | |
run: | | |
make run-tests | |
- name: Save space | |
run: | | |
echo "*************Before save space*************:" | |
df -h | |
du -hs Builds/*/* IntermediateFiles/*/* | |
make --directory Tests clobber | |
echo ""*************After cleanups"*************:" | |
df -h | |
du -hs Builds/*/* IntermediateFiles/*/* | |
- name: Make tools & samples | |
run: | | |
make tools samples | |
- name: Archive Samples Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Sample apps (${{ matrix.displayTargetName }}) | |
if-no-files-found: warn | |
path: | | |
Builds/${{ matrix.config_name }}/*Samples-* | |
- name: Make Documentation | |
run: make documentation | |
- name: Archive Documentation Results | |
uses: actions/upload-artifact@v4 | |
# https://github.com/actions/upload-artifact/issues/506 include matrix configname until bug fixed --LGP 2024-11-27 | |
continue-on-error: true | |
with: | |
name: Stroika-Doxygen-Help.tar.gz | |
path: | | |
Builds/Stroika-Doxygen-Help.tar.gz | |
#Dont name based on who built - sb all the same | |
overwrite: true | |
# https://github.com/actions/upload-artifact/issues/506 include matrix configname until bug fixed --LGP 2024-11-27 | |
# name: ${{ matrix.config_name }}-Stroika-Doxygen-Help.tar.gz | |
- name: Archive Log Data | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Log Data (${{ matrix.displayTargetName }}) | |
if-no-files-found: warn | |
path: | | |
Builds/${{ matrix.config_name }}/PerformanceDump.txt | |
IntermediateFiles/${{ matrix.config_name }}/Samples-HTMLUI/*-Installer-Build-Output.txt | |
IntermediateFiles/${{ matrix.config_name }}/ThirdPartyComponents/boost/ConfigureAndBuild-OUT.txt | |
IntermediateFiles/${{ matrix.config_name }}/ThirdPartyComponents/curl/CONFIGURE-OUT.txt | |
/tmp/Trace*.txt | |
- name: Archive Core-Dumps | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CoreDumps (${{ matrix.displayTargetName }}) | |
if-no-files-found: ignore | |
path: | | |
*core* | |
MacOS: | |
needs: MacOSMatrixPrep | |
runs-on: ${{ matrix.runs_on }} | |
strategy: | |
matrix: ${{fromJson(needs.MacOSMatrixPrep.outputs.matrix)}} | |
env: | |
# vm has 2 virtual CPUs, but 8GB ram, so jobs=3 (empirical), and QUICK_BUILD avoids some internal testing | |
MAKEFLAGS: "--jobs=3 QUICK_BUILD=1" | |
# EXPERIMENTAL FIX TO LIBIDB2 not found https://github.com/actions/runner-images/issues/9638 | |
LIBRARY_PATH: "/opt/homebrew/lib" | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ matrix.xcode }} | |
- uses: actions/checkout@v4 | |
- name: Build System Info | |
run: | | |
echo "CWD: `pwd`" | |
df -h | |
system_profiler SPSoftwareDataType | |
system_profiler SPDeveloperToolsDataType | |
sw_vers | |
echo " X-CODE: `xcodebuild -version | tr '\n' ';'`" | |
echo "LIBRARY_PATH = $LIBRARY_PATH" | |
# If we had docker ability, most of these would be built into a docker file | |
- name: Install Basic Build requirements | |
run: | | |
brew install -q gnu-sed | |
brew install -q p7zip | |
brew install -q autoconf | |
brew install -q libtool | |
brew install -q automake | |
make install-realpath | |
- name: Configure | |
run: | | |
./configure ${{ matrix.config_name }} ${{ matrix.extra_config_args }} | |
cat ConfigurationFiles/${{ matrix.config_name }}.xml | |
- name: Build third-party-components | |
run: | | |
make third-party-components | |
make clean | |
- name: Build Library | |
run: | | |
make libraries | |
- name: Build All | |
run: | | |
make all | |
- name: Run-Tests | |
run: | | |
make run-tests | |
- name: Workaround GitHub-Actions-MacOS Issue with env.TMPDIR | |
if: always() | |
run: | | |
mkdir /tmp/LOGS-ARCHIVE | |
cp $TMPDIR/Trace*.txt /tmp/LOGS-ARCHIVE || : | |
- name: DEBUG Workaround GitHub-Actions-MacOS Issue with env.TMPDIR | |
if: always() | |
run: | | |
echo "TMPDIR=$TMPDIR" | |
echo "TMPDIR using ENV.TMPDIR=${{ env.TMPDIR }}" | |
# Just the echo line above shows empty, and then the ls line causes exit 1/failure | |
#ls -l ${{ env.TMPDIR }}/Trace*.txt | |
#if this gets fixed, then lose Workaround GitHub-Actions-MacOS, and directly reference ${{ env.TMPDIR }}/Trace*.txt in Archive Log Data | |
- name: Build System Info | |
run: | | |
df -h | |
- name: Archive Log Data | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Log Data (${{ matrix.displayTargetName }}) | |
if-no-files-found: warn | |
path: | | |
Builds/${{ matrix.config_name }}/PerformanceDump.txt | |
/tmp/LOGS-ARCHIVE | |
IntermediateFiles/${{ matrix.config_name }}/ThirdPartyComponents/boost/ConfigureAndBuild-OUT.txt | |
IntermediateFiles/${{ matrix.config_name }}/ThirdPartyComponents/curl/BUILD-CONF-TOOLS-OUT.txt | |
IntermediateFiles/${{ matrix.config_name }}/ThirdPartyComponents/curl/CONFIGURE-OUT.txt | |
IntermediateFiles/${{ matrix.config_name }}/ThirdPartyComponents/curl/BUILD-OUT.txt | |
${{ env.TMPDIR }}/Trace*.txt | |
- name: Archive Sample Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Sample apps (${{ matrix.displayTargetName }}) | |
if-no-files-found: warn | |
path: | | |
Builds/${{ matrix.config_name }}/Samples-* | |
Windows: | |
needs: WindowsMatrixPrep | |
runs-on: ${{ matrix.runs_on }} | |
strategy: | |
matrix: ${{fromJson(needs.WindowsMatrixPrep.outputs.matrix)}} | |
env: | |
# vm has 2 virtual CPUs, but 8GB ram, so jobs=2 (empirical sometimes run out of RAM jobs=3), and QUICK_BUILD avoids some internal testing | |
MAKEFLAGS: "--jobs=2 QUICK_BUILD=1" | |
ARTIFACTS_DIR: "c:/Artifacts/" | |
steps: | |
- uses: actions/checkout@v4 | |
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=`echo ${GITHUB_REF#refs/heads/}`" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Build System Info (container version ${{github.event.inputs.container_version || 'v3'}}) | |
shell: "bash" | |
run: | | |
echo "CWD: `pwd`" | |
echo "GITHUB_WORKSPACE: ${GITHUB_WORKSPACE}" | |
df -h | |
systeminfo | |
echo NUMBER_OF_PROCESSORS=$NUMBER_OF_PROCESSORS | |
# No actual need todo this step (would be done implicitly/automatically) - but do to track how long the step takes (13min) | |
- name: docker pull ${{ matrix.container_image }}:${{github.event.inputs.container_version || 'v3'}} | |
run: docker pull ${{ matrix.container_image }}:${{github.event.inputs.container_version || 'v3'}} | |
- name: Start docker build environment | |
shell: "bash" | |
### ash rebaseall nonsense to try and workaround sporadic failure on MSYS | |
### without this rebaseall, about 30% of the time we get a failure in wget wget 3470 child_info_fork::abort: \??\C:\msys64\usr\bin\msys-crypto-1.1.dll: Loaded to different address: parent(0x478B980000) != child(0x400000 | |
### and with this hack, it hasn't happened in years --LGP 2024-03-03 | |
# docker run --interactive --memory 7G --cpus 2 --storage-opt 'size=50GB' -v "${GITHUB_WORKSPACE}:c:\Stroika" --detach --name buildContainer ${{ matrix.container_image }}:${{github.event.inputs.container_version || 'v3'}} ash -c "c:/msys64/usr/bin/rebaseall -v; exec bash" | |
run: | | |
docker run --interactive --memory 7G --cpus 2 --storage-opt 'size=50GB' -v "${GITHUB_WORKSPACE}:c:\Stroika" --detach --name buildContainer ${{ matrix.container_image }}:${{github.event.inputs.container_version || 'v3'}} bash | |
- name: Print Info about docker system | |
shell: "bash" | |
run: | | |
docker ps -a | |
docker exec buildContainer systeminfo | |
docker exec buildContainer df -h | |
- name: Configure | |
shell: "bash" | |
run: | | |
docker exec --workdir c:/Stroika buildContainer sh -c "./configure ${{ matrix.config_name }} ${{ matrix.extra_config_args }}" | |
docker exec --workdir c:/Stroika buildContainer cat ConfigurationFiles/${{ matrix.config_name }}.xml | |
- name: Build All | |
shell: "bash" | |
run: | | |
docker exec --workdir c:/Stroika --env MAKEFLAGS="$MAKEFLAGS" buildContainer make all | |
- name: Run-Tests | |
shell: "bash" | |
run: | | |
docker exec --workdir c:/Stroika --env MAKEFLAGS="$MAKEFLAGS" buildContainer make run-tests | |
- name: Build System Info | |
shell: "bash" | |
run: | | |
df -h | |
docker exec buildContainer df -h | |
- name: Copy Build Artifacts | |
shell: "bash" | |
if: always() | |
# due to flaws in docker (windows must stop) - and cp no wildcards | |
run: | | |
# Because of bind mount, no longer copy out of container, already built in outside filesystem | |
# Just copy out from container the stuff in /tmp | |
(docker exec --workdir c:/ buildContainer bash -c 'mkdir -p /TRACE_LOGS; cp $TEMP/Trace*.txt /TRACE_LOGS/') || : | |
(cp -r "${GITHUB_WORKSPACE}/Builds/${{ matrix.config_name }}/" $ARTIFACTS_DIR) || : | |
docker stop buildContainer | |
(docker cp "buildContainer:TRACE_LOGS/" $ARTIFACTS_DIR) || : | |
rm -rf $ARTIFACTS_DIR/{ThirdPartyComponents,Tests,*.lib} | |
- name: Archive Log Data | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Log Data (${{ matrix.displayTargetName }}) | |
if-no-files-found: warn | |
path: | | |
${{ env.ARTIFACTS_DIR }}PerformanceDump.txt | |
${{ env.ARTIFACTS_DIR }}TRACE_LOGS | |
- name: Archive Sample Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Sample apps (${{ matrix.displayTargetName }}) | |
if-no-files-found: warn | |
path: | | |
${{ env.ARTIFACTS_DIR }}Samples-* | |
codeql-analyze: | |
name: codeql-analyze | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
language: [ 'cpp' ] | |
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | |
# Learn more: | |
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | |
env: | |
# QUICK_BUILD avoids some internal testing | |
MAKEFLAGS: "--jobs=3 QUICK_BUILD=1" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install tools required to build Stroika | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libtool-bin pkg-config cmake automake autoconf libtool-bin | |
sudo apt-get install -y g++ | |
- name: Configure | |
# NOTE - disable optimizer due bugs/errors in optimizer (link errors) - but no matter, cuz also slows down analysis (I think) | |
# --debug-symbols false to save space and cuz no need | |
run: | | |
./configure Release --compiler-driver g++ --apply-default-release-flags --lto disable --append-CXXFLAGS -O0 --debug-symbols false | |
cat ConfigurationFiles/Release.xml | |
# Break out third-party-components to do clean so we dont run out of disk space, and break out TPC AND library | |
# to show the summary time for each part | |
- name: Make third-party-components | |
run: | | |
make third-party-components | |
make clean | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: ${{ matrix.language }} | |
# If you wish to specify custom queries, you can do so here or in a config file. | |
# By default, queries listed here will override any specified in a config file. | |
# Prefix the list here with "+" to use these queries and those in the config file. | |
# queries: ./path/to/local/query, your-org/your-repo/queries@main | |
- name: Make Stroika | |
run: make all | |
- name: Archive Log Data | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Log Data (codeql-analyze) | |
if-no-files-found: warn | |
path: | | |
IntermediateFiles/Release/Samples-HTMLUI/*-Installer-Build-Output.txt | |
IntermediateFiles/Release/ThirdPartyComponents/curl/CONFIGURE-OUT.txt | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 |