|
| 1 | + |
| 2 | +name: 'Tests' |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + |
| 7 | + pull_request: |
| 8 | + types: [opened, synchronize] #labeled, assigned] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-and-test: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + python-version: [3.6, 3.8] # 2.7, |
| 16 | + |
| 17 | + steps: |
| 18 | + # --- Install steps |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v2 |
| 21 | + with: |
| 22 | + submodules: recursive |
| 23 | + |
| 24 | + # --- Versioning |
| 25 | + - name: Versioning |
| 26 | + id: versioning |
| 27 | + run: | |
| 28 | + git fetch --unshallow |
| 29 | + export VERSION_TAG="" |
| 30 | + export VERSION_NAME=`git describe | sed 's/\(.*\)-.*/\1/'` |
| 31 | + echo "GIT DESCRIBE: `git describe`" |
| 32 | + echo "GITHUB_REF: $GITHUB_REF" |
| 33 | + echo "VERSION_NAME $VERSION_NAME" |
| 34 | + if [[ $GITHUB_REF == *"tags"* ]]; then export VERSION_TAG=${GITHUB_REF/refs\/tags\//} ; fi |
| 35 | + echo "VERSION_TAG $VERSION_TAG" |
| 36 | + if [[ "$VERSION_TAG" == "" ]]; then export VERSION_TAG="vdev" ; fi |
| 37 | + if [[ "$VERSION_TAG" != "vdev" ]]; then export VERSION_NAME=$VERSION_TAG ; fi |
| 38 | + echo "VERSION_NAME: $VERSION_NAME" |
| 39 | + echo "VERSION_TAG : $VERSION_TAG" |
| 40 | + if [[ "$VERSION_TAG" == "vdev" ]]; then export VERSION_NAME=$VERSION_NAME"-dev" ; fi |
| 41 | + if [[ "$VERSION_TAG" != "vdev" ]]; then export FULL_VERSION_NAME="version $VERSION_NAME" ; fi |
| 42 | + if [[ "$VERSION_TAG" == "vdev" ]]; then export FULL_VERSION_NAME="latest dev. version $VERSION_NAME" ; fi |
| 43 | + echo "VERSION_NAME: $VERSION_NAME" |
| 44 | + echo "FULL_VERSION_NAME: $FULL_VERSION_NAME" |
| 45 | + echo "::set-output name=FULL_VERSION_NAME::$FULL_VERSION_NAME" |
| 46 | + echo "::set-output name=VERSION_NAME::$VERSION_NAME" |
| 47 | + echo "::set-output name=VERSION_TAG::$VERSION_TAG" |
| 48 | +
|
| 49 | + - name: Set up Python ${{ matrix.python-version }} |
| 50 | + uses: actions/setup-python@v2 |
| 51 | + with: |
| 52 | + python-version: ${{ matrix.python-version }} |
| 53 | + |
| 54 | + - name: Install python dependencies |
| 55 | + run: | |
| 56 | + python -m pip install --upgrade pip |
| 57 | + pip install -r _tools/travis_requirements.txt |
| 58 | + pip install -r weio/requirements.txt |
| 59 | +
|
| 60 | + - name: System info |
| 61 | + run: | |
| 62 | + echo "Actor : $GITHUB_ACTOR" |
| 63 | + echo "Branch: $GITHUB_REF" |
| 64 | + pip list |
| 65 | + ls |
| 66 | +
|
| 67 | + # --- Run Tests |
| 68 | + - name: Tests |
| 69 | + run: | |
| 70 | + make test |
| 71 | +
|
| 72 | +
|
| 73 | + # --- Check if Deployment if needed |
| 74 | + - name: Check if deployment is needed |
| 75 | + id: check_deploy |
| 76 | + env: |
| 77 | + PY_VERSION: ${{matrix.python-version}} |
| 78 | + GH_EVENT : ${{github.event_name}} |
| 79 | + run: | |
| 80 | + echo "GH_EVENT : $GH_EVENT" |
| 81 | + echo "PY_VERSION : $PY_VERSION" |
| 82 | + export OK=0 |
| 83 | + if [[ $PY_VERSION == "3.6" ]]; then export OK=1 ; fi |
| 84 | + if [[ "$OK" == "1" && $GH_EVENT == "push" ]]; then export OK=1 ; fi |
| 85 | + echo "DEPLOY : $OK" |
| 86 | + echo "::set-output name=GO::$OK" |
| 87 | +
|
| 88 | + # --- Run Deployments |
| 89 | + - name: Install system dependencies |
| 90 | + if: ${{ steps.check_deploy.outputs.GO == '1'}} |
| 91 | + run: sudo apt-get install nsis |
| 92 | + |
| 93 | + |
| 94 | + - name: Before deploy |
| 95 | + if: ${{ steps.check_deploy.outputs.GO == '1'}} |
| 96 | + id: before_deploy |
| 97 | + env: |
| 98 | + FULL_VERSION_NAME: ${{steps.versioning.outputs.FULL_VERSION_NAME}} |
| 99 | + VERSION_NAME: ${{steps.versioning.outputs.VERSION_NAME}} |
| 100 | + VERSION_TAG: ${{steps.versioning.outputs.VERSION_TAG}} |
| 101 | + run: | |
| 102 | + echo "FULL_VERSION_NAME: $FULL_VERSION_NAME" |
| 103 | + echo "VERSION_NAME : $VERSION_NAME" |
| 104 | + echo "VERSION_TAG : $VERSION_TAG" |
| 105 | + pip install pynsist |
| 106 | + pip install distlib |
| 107 | + git clone https://github.com/takluyver/pynsist |
| 108 | + mv pynsist/nsist nsist |
| 109 | + sh _tools/setVersion.sh $VERSION_NAME |
| 110 | + make installer |
| 111 | + mv build/nsis/pyDatView_setup.exe "pyDatView_"$VERSION_NAME"_setup.exe" |
| 112 | + mv _tools/pyDatView.cmd build/nsis/ |
| 113 | + mv _tools/pyDatView_Test.bat build/nsis/ |
| 114 | + mv _tools/pyDatView.exe build/nsis/ |
| 115 | + mv build/nsis build/pyDatView_$VERSION_NAME |
| 116 | + cd build && zip -r "../pyDatView_"$VERSION_NAME"_portable.zip" pyDatView_$VERSION_NAME |
| 117 | + cd .. |
| 118 | + if [[ "$VERSION_TAG" == "vdev" ]]; then cp "pyDatView_"$VERSION_NAME"_setup.exe" "pyDatView_LatestVersion_setup.exe" ;fi |
| 119 | + if [[ "$VERSION_TAG" == "vdev" ]]; then cp "pyDatView_"$VERSION_NAME"_portable.zip" "pyDatView_LatestVersion_portable.zip" ;fi |
| 120 | + ls |
| 121 | +
|
| 122 | + - name: Deploy |
| 123 | + if: ${{ steps.check_deploy.outputs.GO == '1'}} |
| 124 | + env: |
| 125 | + FULL_VERSION_NAME: ${{steps.versioning.outputs.FULL_VERSION_NAME}} |
| 126 | + VERSION_NAME: ${{steps.versioning.outputs.VERSION_NAME}} |
| 127 | + VERSION_TAG: ${{steps.versioning.outputs.VERSION_TAG}} |
| 128 | + uses: svenstaro/upload-release-action@v2 |
| 129 | + with: |
| 130 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 131 | + file: pyDatView_*.* |
| 132 | + release_name: ${{steps.versioning.outputs.FULL_VERSION_NAME}} |
| 133 | + tag: ${{steps.versioning.outputs.VERSION_TAG}} |
| 134 | + overwrite: true |
| 135 | + file_glob: true |
| 136 | + body: | |
| 137 | + Different development versions are found in the "Assets" below. |
| 138 | +
|
| 139 | + Select the one with the highest number to get the latest development version. |
| 140 | +
|
| 141 | + 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. |
0 commit comments