Merge pull request #79 from ixfd64/feature/timestamp-options #232
This file contains hidden or 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 is part of mfaktc. | |
# Copyright (c) 2025 NStorm (https://github.com/N-Storm) | |
# Copyright (c) 2009-2011 Oliver Weihe ([email protected]) | |
# | |
# mfaktc is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# mfaktc is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with mfaktc. If not, see <http://www.gnu.org/licenses/>. | |
# | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
name: mfaktc CI | |
on: | |
push: | |
paths-ignore: | |
- '**/*.txt' | |
- '**/*.ini' | |
- 'COPYING' | |
- '.gitignore' | |
pull_request: | |
paths-ignore: | |
- '**/*.txt' | |
- '**/*.ini' | |
- 'COPYING' | |
- '.gitignore' | |
types: | |
- 'opened' | |
- 'reopened' | |
- 'synchronize' | |
- 'ready_for_review' | |
workflow_dispatch: | |
jobs: | |
# Begin job "build-linux" | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
# If set to true, all jobs within the same matrix (such as Linux or | |
# Windows builds) will be aborted at the same time if any one job fails. | |
fail-fast: false | |
matrix: | |
sys: | |
# Specified version combination must exist as CUDA container image from Nvidia: nvcr.io/nvidia/cuda:${{ matrix.sys.cuda_version }}-devel-${{ matrix.sys.ct_os }} | |
# Available versions can be found here: https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags (note that only Ubuntu distros are supported by this action) | |
- { cuda_version: '13.0.0', ct_os: 'ubuntu24.04' } | |
- { cuda_version: '12.9.1', ct_os: 'ubuntu24.04' } | |
# - { cuda_version: '12.9.0', ct_os: 'ubuntu24.04' } | |
- { cuda_version: '12.8.1', ct_os: 'ubuntu24.04' } | |
# - { cuda_version: '12.8.0', ct_os: 'ubuntu24.04' } | |
- { cuda_version: '12.6.3', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.6.2', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.6.1', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.6.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '12.5.1', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.5.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '12.4.1', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.4.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '12.3.2', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.3.1', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.3.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '12.2.2', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.2.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '12.1.1', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.1.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '12.0.1', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '12.0.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '11.8.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '11.7.1', ct_os: 'ubuntu22.04' } | |
# - { cuda_version: '11.7.0', ct_os: 'ubuntu22.04' } | |
- { cuda_version: '11.6.2', ct_os: 'ubuntu20.04' } | |
# - { cuda_version: '11.6.1', ct_os: 'ubuntu20.04' } | |
# - { cuda_version: '11.6.0', ct_os: 'ubuntu20.04' } | |
- { cuda_version: '11.5.2', ct_os: 'ubuntu20.04' } | |
# - { cuda_version: '11.5.1', ct_os: 'ubuntu20.04' } | |
# - { cuda_version: '11.5.0', ct_os: 'ubuntu20.04' } | |
- { cuda_version: '11.4.3', ct_os: 'ubuntu20.04' } | |
- { cuda_version: '11.3.1', ct_os: 'ubuntu20.04' } | |
- { cuda_version: '11.2.2', ct_os: 'ubuntu20.04' } | |
- { cuda_version: '11.1.1', ct_os: 'ubuntu20.04' } | |
- { cuda_version: '11.0.3', ct_os: 'ubuntu20.04' } | |
- { cuda_version: '10.2', ct_os: 'ubuntu18.04' } | |
- { cuda_version: '9.2', ct_os: 'ubuntu18.04' } | |
- { cuda_version: '8.0', ct_os: 'ubuntu16.04' } | |
env: | |
# We can't use GitHub direct container support on old Ubuntu versions, | |
# because actions will fail due to an old glibc version. | |
# A workaround is to use 'docker exec' to run build-related actions in | |
# a separately launched Docker container, while generic actions will run | |
# on the host runner. | |
CONTAINER: "nvcr.io/nvidia/cuda:${{ matrix.sys.cuda_version }}-devel-${{ matrix.sys.ct_os }}" | |
steps: | |
- name: Start Docker container | |
run: | | |
docker pull $CONTAINER | |
docker run --name build-container -d -v ${GITHUB_WORKSPACE}:/workspace $CONTAINER tail -f /dev/null | |
- name: Update GPG keys for CUDA repo on Ubuntu 16.04 | |
if: matrix.sys.ct_os == 'ubuntu16.04' | |
env: | |
SCRIPT: apt-key add /workspace/3bf863cc.pub | |
run: | | |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub | |
docker exec build-container bash -c "$SCRIPT" | |
- name: Update and install dependencies inside container | |
id: packages | |
env: | |
SCRIPT: | | |
apt-get update | |
apt-get -y full-upgrade | |
apt-get install -y build-essential curl git make python3 sudo unzip wget zip | |
run: docker exec build-container bash -c "$SCRIPT" | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Prepare sources and gather info | |
id: prepare | |
env: | |
SCRIPT: | | |
cd /workspace | |
git config --global --add safe.directory /workspace | |
bash .github/workflows/scripts/build_helper.sh ${{ matrix.sys.cuda_version }} | |
run: | | |
docker exec build-container bash -c "$SCRIPT" | |
cat .github/workflows/scripts/build_helper.sh.out >> $GITHUB_OUTPUT | |
- name: Build from sources | |
env: | |
SCRIPT: cd /workspace/src && make -j$(nproc) | |
run: docker exec build-container bash -c "$SCRIPT" | |
- name: Prepare ZIP archive with description | |
env: | |
SCRIPT: | | |
cd /workspace | |
zip -9 -j ${{ steps.prepare.outputs.BASE_NAME }}.zip Changelog.txt COPYING mfaktc mfaktc.ini README.txt | |
echo "[${{ steps.prepare.outputs.BASE_NAME }}.zip](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ steps.prepare.outputs.BASE_NAME }}.zip) | \ | |
${{ matrix.sys.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \ | |
${{ steps.prepare.outputs.COMPILER_VER }} | ${{ steps.prepare.outputs.NVCC_VER }}" > ${{ steps.prepare.outputs.BASE_NAME }}.txt | |
run: docker exec build-container bash -c "$SCRIPT" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepare.outputs.BASE_NAME }} | |
path: ${{ steps.prepare.outputs.BASE_NAME }}.* | |
# End job "build-linux" | |
# Begin job "build-win" | |
build-win: | |
# windows-2022 also works and produces nearly identical binaries, so let's | |
# target the image that will be supported in the longer term. windows-2025 | |
# is in beta as of June 2025, but testing has shown it is reliable. | |
runs-on: windows-2025 | |
strategy: | |
# If set to true, all jobs within the same matrix (such as Linux or | |
# Windows builds) will be aborted at the same time if any one job fails. | |
fail-fast: false | |
matrix: | |
# Available CUDA versions can be viewed at the Jimver/cuda-toolkit action sources: | |
# https://github.com/Jimver/cuda-toolkit/blob/v0.2.24/src/links/windows-links.ts | |
sys: | |
- { cuda_version: '13.0.0' } | |
- { cuda_version: '12.9.1' } | |
- { cuda_version: '12.8.1' } | |
- { cuda_version: '12.6.3' } | |
- { cuda_version: '12.5.1' } | |
- { cuda_version: '12.4.1' } | |
- { cuda_version: '12.3.2' } | |
- { cuda_version: '12.2.2' } | |
- { cuda_version: '12.1.1' } | |
- { cuda_version: '12.0.1' } | |
- { cuda_version: '11.8.0' } | |
- { cuda_version: '11.7.1' } | |
- { cuda_version: '11.6.2' } | |
- { cuda_version: '11.5.2' } | |
- { cuda_version: '11.4.4' } | |
- { cuda_version: '11.3.1' } | |
- { cuda_version: '11.2.2' } | |
- { cuda_version: '11.1.1' } | |
- { cuda_version: '11.0.1' } | |
- { cuda_version: '10.0.130' } | |
- { cuda_version: '9.2.148' } | |
- { cuda_version: '8.0.61' } | |
env: | |
MSVC_PKG_VC140: Microsoft.VisualStudio.Component.VC.140 | |
MSVC_PKG_VC141: Microsoft.VisualStudio.Component.VC.v141.x86.x64 | |
MSVC_SETUP_CMD: '"C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" modify --passive --norestart --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"' | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Install CUDA Toolkit | |
id: cuda-toolkit | |
uses: N-Storm/[email protected] | |
with: | |
cuda: ${{ matrix.sys.cuda_version }} | |
sub-packages: ${{ startsWith(matrix.sys.cuda_version, '8.') && '[]' || startsWith(matrix.sys.cuda_version, '13.') &&'[ "nvcc", "crt", "cudart", "nvvm", "nvptxcompiler" ]' || '[ "nvcc", "cudart" ]' }} | |
use-local-cache: false | |
use-github-cache: false | |
- name: Configure path to CUDA | |
shell: powershell | |
run: | | |
[System.Environment]::SetEnvironmentVariable('PATH', "$env:CUDA_PATH\bin;$env:PATH", 'User') | |
- name: Prepare sources and gather info | |
id: prepare | |
shell: bash | |
run: | | |
bash .github/workflows/scripts/build_helper.sh ${{ matrix.sys.cuda_version }} | |
cat .github/workflows/scripts/build_helper.sh.out >> $GITHUB_OUTPUT | |
- name: Build from sources with MSVC | |
shell: cmd | |
run: | | |
${{ env.MSVC_ADD_PKG_CMD }} | |
"${{ env.VCVARS_PATH }}" x64 ${{ env.VCVARS_VER }} & cd src & copy mfaktc.ini .. & make SHELL="powershell.exe" -j%NUMBER_OF_PROCESSORS% -f Makefile.win & cl /? 2>&1 | findstr /C:"Version" > clversion.log & echo Build finished | |
env: | |
VCVARS_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat' | |
# vcvars_ver=14.x enables Build Tools for previous MSVC versions: | |
# - 14.0 is for Visual Studio 2015 | |
# - 14.16 is for Visual Studio 2017 version 15.9.x | |
# - 14.29 is for Visual Studio 2019 version 16.11.x | |
VCVARS_VER: >- | |
${{ ( | |
steps.prepare.outputs.CUDA_VER_MAJOR <= 9 && '-vcvars_ver=14.0' | |
|| steps.prepare.outputs.CUDA_VER_MAJOR == 10 && '-vcvars_ver=14.16' | |
|| steps.prepare.outputs.CUDA_VER_MAJOR == 11 && steps.prepare.outputs.CUDA_VER_MINOR <= 2 && '-vcvars_ver=14.29' | |
|| '' | |
) }} | |
# Build Tools for Visual Studio 2019 (named VC142 internally) are | |
# included with windows-2022 and later. However, the Build Tools for | |
# older MSVC versions need to be installed by running '${MSVC_SETUP_CMD} --add <package name>' | |
# | |
# - ${MSVC_PKG_VC140} is required for 14.0 / MSVC 2015 | |
# - ${MSVC_PKG_VC141} is required for 14.16 / MSVC 2017 version 15.9.x | |
MSVC_ADD_PKG_CMD: >- | |
${{ ( | |
steps.prepare.outputs.CUDA_VER_MAJOR <= 9 && format('{0} --add {1}', env.MSVC_SETUP_CMD, env.MSVC_PKG_VC140) | |
|| steps.prepare.outputs.CUDA_VER_MAJOR == 10 && format('{0} --add {1}', env.MSVC_SETUP_CMD, env.MSVC_PKG_VC141) | |
|| 'echo Build Tools already exist - installation not needed' | |
) }} | |
- name: Prepare build archive with description | |
shell: bash | |
# We can't get the actual compiler (cl.exe) version with the helper | |
# script because cl might not be installed during the 'Prepare sources | |
# and gather info' step. COMPILER_VER is set to the MSVC rather than | |
# the cl version number, so we added a hack to log the cl version | |
# during the build step. Here, the cl version is extracted and added to | |
# the table along with the MSVC version. | |
run: | | |
[ -f src/clversion.log ] && CL_VER="$(grep -Eoe 'Version [\.0-9]+ ' src/clversion.log | cut -d' ' -f2)" | |
[ -z "$CL_VER" ] && CL_VER='Unknown' | |
7z a -tzip -mx=9 "${{ steps.prepare.outputs.BASE_NAME }}.zip" Changelog.txt COPYING mfaktc-win-64.exe mfaktc.ini README.txt | |
echo "[${{ steps.prepare.outputs.BASE_NAME }}.zip](https://github.com/${GITHUB_REPOSITORY}/releases/download/${GITHUB_REF_NAME}/${{ steps.prepare.outputs.BASE_NAME }}.zip) | \ | |
${{ matrix.sys.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \ | |
${CL_VER} (${{ steps.prepare.outputs.COMPILER_VER }}) | ${{ steps.prepare.outputs.NVCC_VER }}" > ${{ steps.prepare.outputs.BASE_NAME }}.txt | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.prepare.outputs.BASE_NAME }} | |
path: ${{ steps.prepare.outputs.BASE_NAME }}.* | |
# End job "build-win" | |
# Begin job "upload-release" | |
upload-release: | |
# Git tag name must begin with the version specified by MFAKTC_VERSION in | |
# params.h or else the job will fail | |
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/') | |
needs: [ build-linux, build-win ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
base_name: mfaktc-${{ github.ref_name }}*-cuda*/mfaktc-${{ github.ref_name }}*-cuda* | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Prepare asset list and release notes | |
id: makeinfo | |
run: | | |
if ! compgen -G "${base_name}.txt" > /dev/null 2>&1; then | |
echo "::error ::Could not find release notes with mask ${base_name}.txt" | |
echo "::error ::Ensure the Git tag name begins with the version specified by MFAKTC_VERSION in src/params.h" | |
exit 1 | |
fi | |
{ | |
echo "Pre-compiled binaries (automated builds) as follows." | |
echo "In this table, the Compute Capability column means the minimum and maximum versions supported." | |
echo | |
echo "File | CUDA version | Compute Capability | Build OS | Host compiler | NVCC version" | |
echo "--- | --- | --- | --- | --- | ---" | |
sort -Vr ${base_name}.txt | |
} > RELEASE_NOTES.txt | |
{ | |
echo 'RELEASE_FILES<<EOF' | |
printf '%s\n' "${base_name}.zip" | sort -Vr | |
echo 'EOF' | |
} > $GITHUB_OUTPUT | |
( echo "$GITHUB_REF_NAME" | grep -qsP "v?\d+(?:\.\d+(?:\.\d+)?(?:-\d+)?|\b)(-(?:alpha|beta|pre))" && echo "PRERELEASE=true" || echo "PRERELEASE=false" ) >> $GITHUB_OUTPUT | |
- name: Create and upload release package | |
uses: softprops/[email protected] | |
with: | |
fail_on_unmatched_files: false | |
files: | | |
${{ steps.makeinfo.outputs.RELEASE_FILES }} | |
preserve_order: true | |
prerelease: ${{ steps.makeinfo.outputs.PRERELEASE }} | |
generate_release_notes: true | |
body_path: RELEASE_NOTES.txt | |
make_latest: true | |
# End job "upload-release" |