Scripter: using openfast_toolbox #333
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: 'Tests' | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize] #labeled, assigned] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9, 3.11] | |
steps: | |
# --- Install steps | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
# --- Versioning | |
- name: Versioning | |
id: versioning | |
run: | | |
git fetch --unshallow > /dev/null | |
git fetch --tags --force > /dev/null | |
export CURRENT_TAG="v0.4" | |
export CURRENT_DEV_TAG="$CURRENT_TAG-dev" | |
# BRANCH FAILS | |
export BRANCH1=`git rev-parse --abbrev-ref HEAD` | |
export BRANCH="${GITHUB_REF#refs/heads/}" | |
echo "GIT DESCRIBE: `git describe`" | |
echo "GITHUB_REF: $GITHUB_REF" | |
echo "GIT BRANCH1: $BRANCH1" | |
echo "GIT BRANCH: $BRANCH" | |
echo "Commits: `git rev-list $CURRENT_TAG.. --count`" | |
echo "Commits-dev: `git rev-list $CURRENT_DEV_TAG.. --count`" | |
# Check if current version corresponds to a tagged commit | |
if [[ $GITHUB_REF == *"tags"* ]]; then | |
echo ">>> This is a tagged version" | |
export VERSION_TAG=${GITHUB_REF/refs\/tags\//} | |
export VERSION_NAME=$VERSION_TAG | |
export FULL_VERSION_NAME="version $VERSION_NAME" | |
elif [[ $GITHUB_REF == *"main"* ]]; then | |
echo ">>> This is not a tagged version, but on the main branch" | |
export VERSION_TAG=$CURRENT_TAG | |
export VERSION_NAME="$CURRENT_TAG-`git rev-list $CURRENT_TAG.. --count`" | |
export FULL_VERSION_NAME="version $VERSION_NAME" | |
#elif [[ $BRANCH == "dev" ]]; then | |
# echo ">>> This is not a tagged version, but on the dev branch" | |
# export VERSION_TAG=$CURRENT_DEV_TAG ; | |
# export VERSION_NAME=`git describe | sed 's/\(.*\)-.*/\1/'` | |
# export FULL_VERSION_NAME="latest dev. version $VERSION_NAME" | |
else | |
echo ">>> This is not a tagged version, but on a special branch" | |
export VERSION_TAG=$CURRENT_DEV_TAG ; | |
export VERSION_NAME=`git describe | sed 's/\(.*\)-.*/\1/'` | |
export FULL_VERSION_NAME="latest dev. version $VERSION_NAME" | |
fi | |
echo "VERSION_TAG $VERSION_TAG" | |
echo "VERSION_NAME: $VERSION_NAME" | |
echo "FULL_VERSION_NAME: $FULL_VERSION_NAME" | |
# Save variables as github outputs | |
echo "BRANCH=$BRANCH" >> $GITHUB_OUTPUT | |
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_OUTPUT | |
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_OUTPUT | |
echo "FULL_VERSION_NAME=$FULL_VERSION_NAME" >> $GITHUB_OUTPUT | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install python dependencies | |
run: | | |
#python -m pip install --upgrade pip | |
# --- Attempt for wxpython, but we don't have access to X display | |
#sudo apt-get install libgtk-3-dev | |
#sudo apt-get install git curl libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0 || true | |
#sudo apt-get install libnotify-dev || true | |
#sudo apt-get install libnotify4 || true | |
#pip install -U wxpython || true | |
#pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython || true | |
pip install -r _tools/travis_requirements.txt | |
pip install -e . | |
- name: System info | |
run: | | |
echo "Actor : $GITHUB_ACTOR" | |
echo "Branch: $GITHUB_REF" | |
pip list | |
ls | |
# --- Run Tests | |
- name: Tests | |
run: | | |
make test | |
# --- Check if Deployment if needed | |
- name: Check if deployment is needed | |
id: check_deploy | |
env: | |
PY_VERSION: ${{matrix.python-version}} | |
GH_EVENT : ${{github.event_name}} | |
BRANCH : ${{steps.versioning.outputs.BRANCH}} | |
run: | | |
echo "GH_EVENT : $GH_EVENT" | |
echo "PY_VERSION : $PY_VERSION" | |
echo "GIT BRANCH : $BRANCH" | |
export OK=0 | |
# Only deploy for push events | |
if [[ $PY_VERSION == "3.9" ]]; then | |
if [[ $GH_EVENT == "push" ]]; then | |
# BRANCH FAILS | |
if [[ $BRANCH == "main" ]] || [[ $BRANCH == "dev" ]] || [[ $BRANCH == "HEAD" ]] ; then | |
export OK=1 ; | |
fi | |
fi | |
fi | |
echo "DEPLOY : $OK" | |
if [[ $OK == "1" ]]; then | |
echo ">>> Deployment WILL take place" | |
else | |
echo ">>> Deployment WILL NOT take place" | |
fi | |
# Save variables as github outputs | |
echo "GO=$OK" >> $GITHUB_OUTPUT | |
# --- Run Deployments | |
- name: Install system dependencies | |
if: ${{ steps.check_deploy.outputs.GO == '1'}} | |
run: sudo apt-get install nsis | |
- name: Before deploy | |
if: ${{ steps.check_deploy.outputs.GO == '1'}} | |
id: before_deploy | |
env: | |
FULL_VERSION_NAME: ${{steps.versioning.outputs.FULL_VERSION_NAME}} | |
VERSION_NAME: ${{steps.versioning.outputs.VERSION_NAME}} | |
VERSION_TAG: ${{steps.versioning.outputs.VERSION_TAG}} | |
run: | | |
echo "FULL_VERSION_NAME: $FULL_VERSION_NAME" | |
echo "VERSION_NAME : $VERSION_NAME" | |
echo "VERSION_TAG : $VERSION_TAG" | |
pip install pynsist | |
pip install distlib | |
git clone https://github.com/takluyver/pynsist | |
mv pynsist/nsist nsist | |
sh _tools/setVersion.sh $VERSION_NAME | |
make installer | |
mv build/nsis/pyDatView_setup.exe "pyDatView_"$VERSION_NAME"_setup.exe" | |
mv _tools/pyDatView.cmd build/nsis/ | |
mv _tools/pyDatView_Test.bat build/nsis/ | |
mv _tools/pyDatView.exe build/nsis/ | |
mv build/nsis build/pyDatView_$VERSION_NAME | |
cd build && zip -r "../pyDatView_"$VERSION_NAME"_portable.zip" pyDatView_$VERSION_NAME | |
cd .. | |
if [[ "$VERSION_TAG" == *"-dev"* ]]; then cp "pyDatView_"$VERSION_NAME"_setup.exe" "pyDatView_LatestVersion_setup.exe" ;fi | |
if [[ "$VERSION_TAG" == *"-dev"* ]]; then cp "pyDatView_"$VERSION_NAME"_portable.zip" "pyDatView_LatestVersion_portable.zip" ;fi | |
ls | |
- name: Deploy | |
if: ${{ steps.check_deploy.outputs.GO == '1'}} | |
env: | |
FULL_VERSION_NAME: ${{steps.versioning.outputs.FULL_VERSION_NAME}} | |
VERSION_NAME: ${{steps.versioning.outputs.VERSION_NAME}} | |
VERSION_TAG: ${{steps.versioning.outputs.VERSION_TAG}} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: pyDatView_*.* | |
release_name: ${{steps.versioning.outputs.FULL_VERSION_NAME}} | |
tag: ${{steps.versioning.outputs.VERSION_TAG}} | |
overwrite: true | |
file_glob: true | |
body: | | |
Different development versions are found in the "Assets" below. | |
Select the one with the highest number to get the latest development version. | |
Use a file labelled "setup" for a windows installer. No admin right is required for this installation, but the application is not signed. You may use a file labelled "portable" for a self contained zip files. |