Skip to content

Nightly

Nightly #1445

Workflow file for this run

name: Nightly
on:
schedule:
- cron: '0 0 * * *' # run at 0 AM UTC
workflow_dispatch:
inputs:
justification:
description: "Reason for manual run"
required: true
dryRun:
description: "If true, do not upload files"
default: true
env:
SIMC_PROFILE: profiles/CI.simc
ORG_NAME: simulationcraftorg
IMAGE_NAME: simc
jobs:
nightly-build-macos:
name: MacOS Nightly ${{ matrix.source_branch }}
runs-on: macos-latest
strategy:
matrix:
source_branch: [dragonflight]
include:
- source_branch: dragonflight
run_smokeTest: false
- architecture: macos
steps:
- uses: actions/checkout@v3
with:
repository: simulationcraft/simc
ref: ${{ matrix.source_branch }}
# Workaround 2024-04-25 at https://github.com/jurplel/install-qt-action/issues/230
- name: Disable PEP-0688
run: |
mkdir -p "$HOME/Library/Application Support/pip"
echo "[global]" > "$HOME/Library/Application Support/pip/pip.conf"
echo "break-system-packages = true" >> "$HOME/Library/Application Support/pip/pip.conf"
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
modules: qtwebengine qtwebchannel qtpositioning
version: 6.5.*
aqtversion: '==3.1.*'
setup-python: false
- name: Get git hash
id: git_hash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Extract Simc Version info and setup output information
id: simc_info
env:
configHeader: engine/config.hpp
run: |
export SIMC_MAJOR=$(grep -E -e "^#define SC_MAJOR_VERSION" "${{ env.configHeader }}" | sed -E -e "s/#define SC_MAJOR_VERSION \"([0-9]+)\"/\1/g")
export SIMC_MINOR=$(grep -E -e "^#define SC_MINOR_VERSION" "${{ env.configHeader }}" | sed -E -e "s/#define SC_MINOR_VERSION \"([0-9]+)\"/\1/g")
export SIMC_VERSION=$SIMC_MAJOR-$SIMC_MINOR
echo "simc_version=$(echo "$SIMC_VERSION")" >> $GITHUB_OUTPUT
echo "simc_output_file=$(echo "simc-$SIMC_VERSION-osx-x86.dmg")" >> $GITHUB_OUTPUT
echo "simc_nightly_file=$(echo "simc-$SIMC_VERSION-${{ matrix.architecture }}-${{ steps.git_hash.outputs.sha_short }}.dmg")" >> $GITHUB_OUTPUT
echo "$SIMC_VERSION" > ./simc-version
- name: Build and create a release package
env:
SC_DEFAULT_APIKEY: ${{ secrets.SC_DEFAULT_APIKEY }}
run: |
$Qt6_DIR/bin/qmake LTO=1 simulationcraft.pro QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"
make -j $(sysctl -n hw.ncpu) create_release
- name: Smoke Test
if: ${{ matrix.run_smokeTest }}
run: |
./simc ${{ env.SIMC_PROFILE }} iterations=5 output=/dev/null html=/dev/null json2=/dev/null cleanup_threads=1
- name: Rename DMG file to nightly format
run: |
mv ${{ steps.simc_info.outputs.simc_output_file }} ${{ steps.simc_info.outputs.simc_nightly_file }}
- uses: actions/upload-artifact@v3
with:
name: simc-nightly-${{ matrix.architecture }}-${{ matrix.source_branch }}
path: |
${{ steps.simc_info.outputs.simc_nightly_file }}
./simc-version
nightly-build-windows:
name: Windows Nightly ${{ matrix.architecture }} ${{ matrix.source_branch }} ${{ matrix.qt }}
runs-on: windows-latest
env:
SIMCDIR: ${{ github.workspace }}
INSTALL: ${{ github.workspace }}/install
CMAKE_BUILD_DIR: ${{ github.workspace }}/builddir/
uploadDir: ${{ github.workspace }}/upload
strategy:
fail-fast: false
matrix:
qt: [qt6]
targetConfiguration: [Release]
source_branch: [dragonflight]
architecture: [x64, arm64]
include:
- qt: qt6
qt_version: 6.4.0
qt_dir_variable: QT6_DIR
qt_modules: qtwebengine qtwebchannel qtpositioning
- architecture: x64
cl_architecture: x64
package_suffix: win64
qt_arch: win64_msvc2019_64
smokeTest: true
buildGui: ON
- architecture: arm64
cl_architecture: amd64_arm64
package_suffix: winarm64
# Use x64 qt installation for arm, since we can currently build cli only anyway, and require host qmake. If we ever want to fully build the GUI, we need to somehow get both win64_msvc2019_arm64 Qt as well as win64_msvc2019_64 for qmake set up. jurplel/install-qt-actio does not set up the qmake.bat from the arm64 install to correctly point to the x64 qmake.exe, and maybe does not even install it at all.
qt_arch: win64_msvc2019_64
smokeTest: false
buildGui: OFF
qt_modules: ""
- source_branch: dragonflight
smokeTest: false
steps:
- uses: actions/checkout@v3
with:
repository: simulationcraft/simc
ref: ${{ matrix.source_branch }}
- name: Get git hash
id: git_hash
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get cmake
uses: lukka/get-cmake@latest
- name: Add MSBuild and MS C++ Compiler to path
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.cl_architecture }}
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
modules: ${{ matrix.qt_modules }}
arch: ${{ matrix.qt_arch }}
setup-python: 'false'
version: ${{ matrix.qt_version }}
aqtversion: '==3.0.*'
- name: Create Install and Upload Directory
run: |
mkdir ${{ env.INSTALL }}
mkdir ${{ env.uploadDir }}
- name: Extract Simc Version info and setup output information
id: simc_info
env:
configHeader: engine/config.hpp
run: |
$env:simc_major = Get-Content "${{ env.configHeader }}" | Select-String '#define SC_MAJOR_VERSION \"(.+)\"' | ForEach-Object {$_.Matches[0].Groups[1].Value}
$env:simc_minor = Get-Content "${{ env.configHeader }}" | Select-String '#define SC_MINOR_VERSION \"(.+)\"' | ForEach-Object {$_.Matches[0].Groups[1].Value}
mkdir ${{ env.CMAKE_BUILD_DIR }}
echo "$env:simc_major.$env:simc_minor" > ${{ env.CMAKE_BUILD_DIR }}/simc-version
- name: Generate project files
run: |
cmake -B "${{ env.CMAKE_BUILD_DIR }}" -GNinja -DBUILD_GUI=${{ matrix.buildGui }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=${{ steps.simc_info.outputs.install_dir}} -DSC_DEFAULT_APIKEY=${{ secrets.SC_DEFAULT_APIKEY }} -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=1 -DCPACK_SYSTEM_NAME=${{ matrix.package_suffix }} --log-level=VERBOSE
- name: Build
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target all
- name: Smoke Test
if: ${{ matrix.smokeTest }}
run: |
& "${{ env.CMAKE_BUILD_DIR }}/simc.exe" ${{ env.SIMC_PROFILE }} iterations=5 output=nul html=nul json2=nul cleanup_threads=1
- name: Package
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target package
- uses: actions/upload-artifact@v3
with:
name: simc-nightly-${{ matrix.package_suffix }}-${{ matrix.source_branch }}
path: |
${{ env.CMAKE_BUILD_DIR }}/*.7z
${{ env.CMAKE_BUILD_DIR }}/simc-version
nightly-upload:
name: Nightly Upload ${{ matrix.source_branch }} ${{ matrix.package_suffix }}
runs-on: ubuntu-latest
needs: [nightly-build-windows, nightly-build-macos]
if: ${{ github.event.inputs.dryRun != 'true' }}
strategy:
matrix:
package_suffix: [win64, winarm64, macos]
source_branch: [dragonflight]
include:
- package_suffix: win64
file_extension: 7z
- package_suffix: winarm64
file_extension: 7z
- package_suffix: macos
file_extension: dmg
steps:
- name: Install sftp utils
run: |
sudo apt install sshpass
- uses: actions/download-artifact@v3
with:
name: simc-nightly-${{ matrix.package_suffix }}-${{ matrix.source_branch }}
path: ${{ github.workspace }}/artifacts
# Use specific commit id here to fix known-hosts input not working.
- name: SFTP Upload
run: |
export SIMCVERSION=$(cat ${{ env.local-dir }}/simc-version | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
mkdir -p ~/.ssh
echo "${{ secrets.UPLOAD_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
sshpass -e sftp -q ${{ secrets.UPLOAD_USER }}@${{ secrets.UPLOAD_HOST }}:${{ env.remote-dir }} <<< $"rm simc-$SIMCVERSION-${{ matrix.package_suffix }}-*.${{ matrix.file_extension }}"
sshpass -e sftp -q ${{ secrets.UPLOAD_USER }}@${{ secrets.UPLOAD_HOST }}:${{ env.remote-dir }} <<< $"rm simc-$SIMCVERSION.*-${{ matrix.package_suffix }}.${{ matrix.file_extension }}"
sshpass -e sftp -q ${{ secrets.UPLOAD_USER }}@${{ secrets.UPLOAD_HOST }}:${{ env.remote-dir }} <<< $'put ${{ env.local-dir }}/*.${{ matrix.file_extension }}'
env:
SSHPASS: ${{ secrets.UPLOAD_PASSWORD }}
known-hosts: ${{ secrets.UPLOAD_KNOWN_HOSTS }}
remote-dir: /
local-dir: ${{ github.workspace }}/artifacts
docker-image-create-and-publish:
# TODO: this approach could be improved by doing a matrix build like the above jobs do
# matrix could be branch and threads
# threads could be used for different tagged versions too
needs: [nightly-build-windows, nightly-build-macos]
runs-on: ubuntu-latest
strategy:
matrix:
source_branch: [dragonflight]
steps:
- uses: actions/checkout@v3
with:
repository: simulationcraft/simc
ref: ${{ matrix.source_branch }}
path: 'simc'
- name: Get SimulationCraft version
run: |
echo "SIMC_VERSION=$(grep 'SIMC_WOW_VERSION' engine/dbc/generated/client_data_version.inc | sed -E -e 's/#define SIMC_WOW_VERSION \"(.+)\"/\1/')" >> $GITHUB_ENV
working-directory: ./simc
- name: Get SimulationCraft version
run: |
echo "SIMC_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
working-directory: ./simc
- name: Get date
run: |
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
working-directory: ./simc
- name: Create full version string
run: |
echo "VERSION_STRING=$SIMC_VERSION-$DATE-$SIMC_HASH" >> $GITHUB_ENV
- name: Build image
run: |
docker build . --file Dockerfile --build-arg APIKEY=${{ secrets.SC_DEFAULT_APIKEY }} --tag $IMAGE_NAME:$VERSION_STRING --tag $IMAGE_NAME:latest
working-directory: ./simc
- name: Log into registry
run: echo "${{ secrets.DOCKERHUB }}" | docker login -u ${{ secrets.DOCKERHUBUSER }} --password-stdin
- name: Push image
run: |
IMAGE_ID=$ORG_NAME/$IMAGE_NAME
docker tag $IMAGE_NAME:$VERSION_STRING $IMAGE_ID:$VERSION_STRING
docker tag $IMAGE_NAME:latest $IMAGE_ID:latest
docker push $IMAGE_ID:$VERSION_STRING
docker push $IMAGE_ID:latest