Synchronize workflows #100
Workflow file for this run
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
name: Windows Build Matrix | |
# Many thanks to Cristian Adam for examples | |
# e.g. https://github.com/cristianadam/HelloWorld/blob/master/.github/workflows/build_cmake.yml | |
# https://cristianadam.eu/20191222/using-github-actions-with-c-plus-plus-and-cmake/ | |
# This workflow will build and sign on Windows | |
# .. since SignPath requires only a Windows build in the action | |
# .. to successfully sign | |
on: [push, pull_request] | |
env: | |
QT_VERSION: 5.15.2 | |
FEATURES: -DUSE_VTK=ON -DBUILD_GPL_PLUGINS=ON -DBUILD_MOLEQUEUE=OFF -DWITH_COORDGEN=OFF | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows", artifact: "windows-x86_64.exe", | |
os: windows-latest, | |
cc: "cl", cxx: "cl", | |
build_type: "Release", | |
cmake_flags: "", | |
build_flags: "", | |
cpack_flags: "-G NSIS", | |
} | |
- { | |
name: "Windows Qt6", artifact: "", | |
os: windows-latest, | |
cc: "cl", cxx: "cl", | |
build_type: "Release", | |
cmake_flags: "", | |
build_flags: "", | |
cpack_flags: "-G NSIS", | |
env: { | |
QT_VERSION: 6.8.1, | |
} | |
} | |
steps: | |
- name: Install Dependencies (Windows) | |
if: runner.os == 'Windows' | |
run: choco install ninja | |
- name: Checkout openchemistry | |
uses: actions/checkout@v4 | |
with: | |
repository: openchemistry/openchemistry | |
submodules: recursive | |
path: openchemistry | |
- name: Checkout avogadroapp | |
uses: actions/checkout@v4 | |
with: | |
path: openchemistry/avogadroapp | |
fetch-depth: 0 | |
- name: Checkout avogadrolibs | |
uses: actions/checkout@v4 | |
with: | |
repository: openchemistry/avogadrolibs | |
path: openchemistry/avogadrolibs | |
fetch-depth: 0 | |
- name: Checkout i18n | |
uses: actions/checkout@v4 | |
with: | |
repository: openchemistry/avogadro-i18n | |
path: openchemistry/avogadro-i18n | |
- name: Checkout avogadrogenerators | |
uses: actions/checkout@v4 | |
with: | |
repository: openchemistry/avogenerators | |
path: openchemistry/avogadrogenerators | |
- name: Checkout crystals | |
uses: actions/checkout@v4 | |
with: | |
repository: openchemistry/crystals | |
path: openchemistry/crystals | |
- name: Checkout fragments | |
uses: actions/checkout@v4 | |
with: | |
repository: openchemistry/fragments | |
path: openchemistry/fragments | |
- name: Checkout molecules | |
uses: actions/checkout@v4 | |
with: | |
repository: openchemistry/molecules | |
path: openchemistry/molecules | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
aqtversion: '==3.1.*' | |
cache: true | |
version: ${{ env.QT_VERSION }} | |
- name: Configure MSVC Command Prompt | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x64 | |
- name: Grab cache files | |
uses: actions/cache@v4 | |
if: runner.os != 'Windows' | |
with: | |
path: | | |
${{ runner.workspace }}/build/Downloads | |
key: ${{ matrix.config.name }}-downloads | |
- name: Configure | |
run: | | |
if [ ! -d "${{ runner.workspace }}/build" ]; then mkdir "${{ runner.workspace }}/build"; fi | |
cd "${{ runner.workspace }}/build" | |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake $GITHUB_WORKSPACE ${{env.FEATURES}} -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} ${{matrix.config.cmake_flags}} | |
shell: bash | |
- name: Build | |
run: | | |
CC=${{matrix.config.cc}} CXX=${{matrix.config.cxx}} cmake --build . --config ${{matrix.config.build_type}} ${{matrix.config.build_flags}} | |
shell: bash | |
working-directory: ${{ runner.workspace }}/build | |
- name: Create Windows Package | |
if: matrix.config.os == 'windows-latest' | |
shell: bash | |
run: | | |
[[ ! "${GITHUB_REF}" =~ "tags" ]] && export SNAPSHOT_DATE=`date -j "+%d-%m-%y"` | |
cpack ${{ matrix.config.cpack_flags }} | |
working-directory: ${{ runner.workspace }}/build/avogadroapp | |
continue-on-error: true | |
env: | |
OPENSSL_ROOT_DIR: ${{ matrix.config.ssl_env }} | |
- name: Upload | |
if: matrix.config.artifact != 0 | |
id: upload-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ runner.workspace }}/build/avogadroapp/Avogadro*.* | |
name: ${{ matrix.config.artifact }} | |
- name: Sign Windows release | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
uses: signpath/github-action-submit-signing-request@v1 | |
with: | |
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' | |
organization-id: '${{ secrets.SIGNPATH_ORG_ID }}' | |
project-slug: 'avogadrolibs' | |
signing-policy-slug: 'release-signing' | |
github-artifact-id: '${{ steps.upload-artifact.outputs.artifact-id }}' | |
wait-for-completion: true | |
output-artifact-directory: '../build/' | |
- name: Upload | |
if: matrix.config.artifact != 0 | |
id: upload-signed-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ runner.workspace }}/build/Avogadro2*.* | |
name: 'Win64-signed.exe' | |
- name: Setup tmate session | |
if: failure() | |
uses: mxschmitt/action-tmate@v3 | |
- name: Cleanup | |
if: ${{ always() }} # To ensure this step runs even when earlier steps fail | |
shell: bash | |
run: | | |
ls -la ./ | |
rm -rf ./* || true | |
rm -rf ./.??* || true | |
ls -la ./ |