Skip to content

Automatically save Probe Interface files when recording starts #30

Automatically save Probe Interface files when recording starts

Automatically save Probe Interface files when recording starts #30

Workflow file for this run

name: Windows
on:
push:
branches: [main] # NB: Runs whenever a PR is merged to main
pull_request:
branches: [main] # NB: Runs when a PR to main is opened. This can be expanded to run when PRs are opened to other branches (i.e., testing-juce8)
release:
types: [published] # NB: Runs whenever a new release is created. Releases are based on tags, but are separate in that a tag can be created without a concurrent release
jobs:
check-semver:
runs-on: ubuntu-22.04
if: github.event_name != 'release'
steps:
- name: Checkout current version
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find previous release
id: previous-release
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "RELEASE_NAME=$(gh release list -L 1 --json tagName -q .[0].tagName)" >> $GITHUB_OUTPUT
- name: Verify release name
id: verify-release
if: steps.previous-release.outputs.RELEASE_NAME == ''
run: |
echo "No previous releases found. Skipping the semver check."
exit 0
- name: Checkout last release version
if: steps.previous-release.outputs.RELEASE_NAME != ''
uses: actions/checkout@v4
with:
ref: ${{ steps.previous-release.outputs.RELEASE_NAME }}
path: last-release
sparse-checkout: |
Source/OpenEphysLib.cpp
sparse-checkout-cone-mode: false
- name: Extract Versions
if: steps.previous-release.outputs.RELEASE_NAME != ''
id: extract-versions
run: |
ls -la
ls last-release -la
ls last-release/Source -la
cat ./last-release/Source/OpenEphysLib.cpp
echo "CURRENT_VERSION=$(cat ./Source/OpenEphysLib.cpp | grep -w -e 'info->libVersion' | grep -Eo "[0-9]+.[0-9]+.[0-9]+")" >> $GITHUB_OUTPUT
echo "PREVIOUS_VERSION=$(cat ./last-release/Source/OpenEphysLib.cpp | grep -w -e 'info->libVersion' | grep -Eo "[0-9]+.[0-9]+.[0-9]+")" >> $GITHUB_OUTPUT
- name: Setup Python
if: steps.previous-release.outputs.RELEASE_NAME != ''
uses: actions/setup-python@v5
with:
python-version: "3.10.12"
- name: Install semver
if: steps.previous-release.outputs.RELEASE_NAME != ''
run: python -m pip install semver
- name: Compare Versions
if: steps.previous-release.outputs.RELEASE_NAME != ''
run: |
version_current=${{ steps.extract-versions.outputs.CURRENT_VERSION }}
version_release=${{ steps.extract-versions.outputs.PREVIOUS_VERSION }}
echo "Current Version: $version_current"
echo "Release Version: $version_release"
if [ ! $(python -c "import semver; print(semver.compare(\"$version_current\", \"$version_release\"))") == 1 ]; then
echo "::error title=Invalid version number::Version number must be increased"
exit 1
fi
build-windows:
needs: [check-semver]
if: always() && !failure() && !cancelled()
runs-on: windows-latest
outputs:
PLUGIN_API: ${{ steps.setup.outputs.PLUGIN_API }}
PLUGIN_VERSION: ${{ steps.setup.outputs.PLUGIN_VERSION }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
id: setup
run: |
echo "PLUGIN_VERSION=$(grep -w Source/OpenEphysLib.cpp -e 'info->libVersion' | grep -Eo "[0-9]+.[0-9]+.[0-9]+")" >> "$GITHUB_OUTPUT"
cd ../..
git clone https://github.com/open-ephys/plugin-GUI.git --branch main
cd plugin-GUI/Build
cmake -G "Visual Studio 17 2022" -A x64 ..
mkdir Release && cd Release
curl -L https://openephys.jfrog.io/artifactory/GUI-binaries/Libraries/open-ephys-lib-v1.0.0.zip --output open-ephys-lib.zip
unzip open-ephys-lib.zip
echo "PLUGIN_API=$(grep -rnw ../../Source -e '#define PLUGIN_API_VER' | grep -Eo "[0-9]*" | tail -1)" >> "$GITHUB_OUTPUT"
shell: bash
- name: configure
run: |
cd Build
cmake -G "Visual Studio 17 2022" -A x64 ..
shell: bash
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: build-plugin
id: build-plugin
run: |
cd Build
msbuild OE_PLUGIN_onix-source.sln -p:Configuration=Release -p:Platform=x64
shell: cmd
- name: Collect artifact
uses: actions/upload-artifact@v4
if: steps.build-plugin.outcome == 'success' && always()
with:
name: Artifact
if-no-files-found: error
path: |
Build/Release
Build/x64
deploy-windows:
needs: [build-windows]
runs-on: windows-latest
if: github.event_name == 'release' && always() && !failure() && !cancelled()
steps:
- name: Download build folder
uses: actions/download-artifact@v4
with:
name: Artifact
- name: deploy
env:
ARTIFACTORY_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
build_dir: "Release"
liboni_dir: "x64/Release"
package: ONIXSource-windows
run: |
plugin_api=${{ needs.build-windows.outputs.PLUGIN_API }}
tag=${{ needs.build-windows.outputs.PLUGIN_VERSION }}
new_plugin_ver=$tag-API$plugin_api
mkdir plugins
cp $build_dir/*.dll plugins
mkdir shared
cp $liboni_dir/*.dll shared
zipfile=${package}_${new_plugin_ver}.zip
powershell Compress-Archive -Path "plugins" -DestinationPath ${zipfile}
powershell Compress-Archive -U -Path "shared" -DestinationPath ${zipfile}
curl -H "X-JFrog-Art-Api:$ARTIFACTORY_ACCESS_TOKEN" -T $zipfile "https://openephys.jfrog.io/artifactory/ONIXSource-plugin/windows/$zipfile"
shell: bash