Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release actions (temp) #422

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/deploy-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,92 @@ jobs:
with:
user: __token__
password: ${{ secrets.pypi_password }}

ddsclibinaries:
name: Build binary packages for the DDS CLI
needs: build-n-publish
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
TARGET: MacOs_x86_64
CMD_BUILD: pyinstaller -F -c -n dds_cli_macos_x86_64.exe -i resources/scilifelab.icns --exclude-module=tests --target-arch x86_64 --log-level INFO dds_cli/__init__.py
OUT_FILE_NAME: dds_cli_macos_x86_64.exe
ASSET_MIME: application/x-elf
#- os: macos-latest #No virtual environment for this yet
# TARGET: MacOs_arm64
# CMD_BUILD: pyinstaller -F -c -n dds_cli_macos_arm64.exe -i resources/scilifelab.icns --exclude-module=tests --target-arch arm64 --log-level INFO dds_cli/__init__.py
# OUT_FILE_NAME: dds_cli_macos_arm64.exe
# ASSET_MIME: application/x-elf
- os: windows-latest
TARGET: Windows_x86_64
CMD_BUILD: PyInstaller -F -c -n dds_cli_win_x86_64.exe -i resources/scilifelab.ico --exclude-module=tests --log-level INFO dds_cli/__init__.py
OUT_FILE_NAME: dds_cli_win_x86_64.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
steps:
- uses: actions/checkout@v2
- name: Python 3.9 setup
uses: actions/setup-python@v2
with:
python-version: 3.9
# architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyInstaller
pip install -r requirements.txt
- name: Building with PyInstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/${{ matrix.OUT_FILE_NAME}}
asset_name: ${{ matrix.OUT_FILE_NAME}}
asset_content_type: ${{ matrix.ASSET_MIME}}

ddsclidocumentation:
name: Build the DDS CLI Documentation
needs: build-n-publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Make dependencies available to Docker container
run: |
cat requirements.txt requirements-dev.txt > ./docs/requirements.txt
- name: Build the HTML documentation
uses: matthiaszepper/sphinx-action-v4@latest
with:
container: latest
pre-build-command: "pip install dds_cli"
build-command: "make html"
docs-folder: "docs/"
- name: Build the pdf with Sphinx
uses: matthiaszepper/sphinx-action-v4@pdflatex
with:
container: pdflatex
build-command: "make latexpdf"
docs-folder: "docs/"
- name: Create an artifact of the previously built HTML
uses: actions/upload-artifact@v3
with:
name: DocumentationHTML
path: docs/_build/html/
- name: Create an artifact of the previously built pdf
uses: actions/upload-artifact@v3
with:
name: Documentation
path: docs/_build/latex/datadeliverysystem.pdf
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: docs/_build/latex/datadeliverysystem.pdf
asset_name: dds_cli_user_manual.pdf
asset_content_type: application/pdf
161 changes: 161 additions & 0 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: Release the Data Delivery System CLI

on:
push:
tags:
- 'v*' #if a push with a version tag like v0.0.2 is recorded, trigger release and build

jobs:

ddsclirelease:
name: Release DDS CLI
runs-on: [ubuntu-latest]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
${{ github.event.head_commit.message }}
draft: true # change to false for production
prerelease: false


ddsclipypi:
name: Release DDS CLI on PyPi
needs: ddsclirelease
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install -r requirements.txt
- name: Build binary wheel and source tarball
id: build_wheel
shell: bash
run: |
python -m build --sdist --wheel --outdir dist/
wheel=$(find ./dist -name "*.whl")
wheelbase=$(basename $(find ./dist -name "*.whl"))
echo ::set-output name=wheel::$wheel
echo ::set-output name=wheelbase::$wheelbase
- name: Publish to Python Package Index
if: github.repository == 'ScilifelabDataCentre/dds_cli'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Upload Wheel
id: upload-wheel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.ddsclirelease.outputs.upload_url }}
asset_path: ${{ steps.build_wheel.outputs.wheel }}
asset_name: ${{ steps.build_wheel.outputs.wheelbase }}
asset_content_type: application/x-wheel+zip

ddsclibinaries:
name: Build binary packages for the DDS CLI
needs: ddsclirelease
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
TARGET: MacOs_x86_64
CMD_BUILD: pyinstaller -F -c -n dds_cli_macos_x86_64.exe -i resources/scilifelab.icns --exclude-module=tests --target-arch x86_64 --log-level INFO dds_cli/__init__.py
OUT_FILE_NAME: dds_cli_macos_x86_64.exe
ASSET_MIME: application/x-elf
#- os: macos-latest #No virtual environment for this yet
# TARGET: MacOs_arm64
# CMD_BUILD: pyinstaller -F -c -n dds_cli_macos_arm64.exe -i resources/scilifelab.icns --exclude-module=tests --target-arch arm64 --log-level INFO dds_cli/__init__.py
# OUT_FILE_NAME: dds_cli_macos_arm64.exe
# ASSET_MIME: application/x-elf
- os: windows-latest
TARGET: Windows_x86_64
CMD_BUILD: PyInstaller -F -c -n dds_cli_win_x86_64.exe -i resources/scilifelab.ico --exclude-module=tests --log-level INFO dds_cli/__init__.py
OUT_FILE_NAME: dds_cli_win_x86_64.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
steps:
- uses: actions/checkout@v2
- name: Python 3.9 setup
uses: actions/setup-python@v2
with:
python-version: 3.9
# architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyInstaller
pip install -r requirements.txt
- name: Building with PyInstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.ddsclirelease.outputs.upload_url }}
asset_path: ./dist/${{ matrix.OUT_FILE_NAME}}
asset_name: ${{ matrix.OUT_FILE_NAME}}
asset_content_type: ${{ matrix.ASSET_MIME}}

ddsclidocumentation:
name: Build the DDS CLI Documentation
needs: ddsclirelease
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Make dependencies available to Docker container
run: |
cat requirements.txt requirements-dev.txt > ./docs/requirements.txt
- name: Build the HTML documentation
uses: matthiaszepper/sphinx-action-v4@latest
with:
container: latest
pre-build-command: "pip install dds_cli"
build-command: "make html"
docs-folder: "docs/"
- name: Build the pdf with Sphinx
uses: matthiaszepper/sphinx-action-v4@pdflatex
with:
container: pdflatex
build-command: "make latexpdf"
docs-folder: "docs/"
- name: Create an artifact of the previously built HTML
uses: actions/upload-artifact@v3
with:
name: DocumentationHTML
path: docs/_build/html/
- name: Create an artifact of the previously built pdf
uses: actions/upload-artifact@v3
with:
name: Documentation
path: docs/_build/latex/datadeliverysystem.pdf
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.ddsclirelease.outputs.upload_url }}
asset_path: docs/_build/latex/datadeliverysystem.pdf
asset_name: dds_cli_user_manual.pdf
asset_content_type: application/pdf


1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,4 @@ Please add a _short_ line describing the PR you make, if the PR implements a spe
* Delete temporary folder before `DownloadError` and `UploadError` ([#407](https://github.com/ScilifelabDataCentre/dds_cli/pull/407)).
* Allow delete of both folder and files ([#411](https://github.com/ScilifelabDataCentre/dds_cli/pull/411))
* Report number of files deleted for "rm folder" ([#408](https://github.com/ScilifelabDataCentre/dds_cli/pull/408))
* Github Actions to automatically build the executables (with help from @zishanmirza) and the documentations with Sphinx.([#419](https://github.com/ScilifelabDataCentre/dds_cli/pull/419))
12 changes: 10 additions & 2 deletions dds_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pkg_resources
import prompt_toolkit
import rich.console

import sys

###############################################################################
# PROJECT SPEC ################################################# PROJECT SPEC #
Expand All @@ -27,7 +27,6 @@
"dds_questionary_styles",
]


###############################################################################
# VARIABLES ####################################################### VARIABLES #
###############################################################################
Expand Down Expand Up @@ -148,3 +147,12 @@ class FileSegment:

# Determine if the user is on an old terminal without proper Unicode support
dds_on_legacy_console = rich.console.detect_legacy_windows()


if __name__ == "__main__":
from dds_cli.__main__ import dds_main

if getattr(sys, "frozen", False):
dds_main(sys.argv[1:])
else:
dds_main()
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
black
pyinstaller
Sphinx
sphinx_rtd_theme
sphinx_click
Binary file added resources/scilifelab.icns
Binary file not shown.
Binary file added resources/scilifelab.ico
Binary file not shown.