-
Notifications
You must be signed in to change notification settings - Fork 11
142 lines (120 loc) · 4.67 KB
/
linux.yml
File metadata and controls
142 lines (120 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: linux
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
env:
ARTIFACTORY_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
build_dir: "Build"
package: EphysSocket-linux
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: |
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-linux:
needs: [check-semver]
if: always() && !failure() && !cancelled()
runs-on: [ubuntu-22.04]
outputs:
PLUGIN_API: ${{ steps.setup.outputs.PLUGIN_API }}
PLUGIN_VERSION: ${{ steps.setup.outputs.PLUGIN_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- 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"
sudo apt update
cd ../..
git clone https://github.com/open-ephys/plugin-GUI.git --branch main
sudo ./plugin-GUI/Resources/Scripts/install_linux_dependencies.sh
cd plugin-GUI/$build_dir && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
echo "PLUGIN_API=$(grep -rnw ../Source -e '#define PLUGIN_API_VER' | grep -Eo "[0-9]*" | tail -1)" >> "$GITHUB_OUTPUT"
- name: build
id: build
run: |
cd $build_dir
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
make
- name: Collect artifact
uses: actions/upload-artifact@v4
if: steps.build.outcome == 'success' && always()
with:
name: Artifact
if-no-files-found: error
path: ${{ env.build_dir }}
deploy-linux:
needs: [build-linux]
runs-on: ubuntu-22.04
if: github.event_name == 'release' && always() && !failure() && !cancelled()
steps:
- name: Download build folder
uses: actions/download-artifact@v4
with:
name: Artifact
path: ${{ env.build_dir }}
- name: deploy
run: |
plugin_api=${{ needs.build-linux.outputs.PLUGIN_API }}
tag=${{ needs.build-linux.outputs.PLUGIN_VERSION }}
new_plugin_ver=$tag-API$plugin_api
mkdir plugins
cp -r $build_dir/*.so plugins
zipfile=${package}_${new_plugin_ver}.zip
zip -r -X $zipfile plugins
curl -H "X-JFrog-Art-Api:$ARTIFACTORY_ACCESS_TOKEN" -T $zipfile "https://openephys.jfrog.io/artifactory/EphysSocket-plugin/linux/$zipfile"