Skip to content
Merged
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
77 changes: 69 additions & 8 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ jobs:
id: extract_branch
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
push-binary:

push-binary-linux:
needs: [ extract-branch-name ]
if: ${{ needs.extract-branch-name.outputs.branch == 'main' || needs.extract-branch-name.outputs.branch == 'develop' }}
if: ${{ needs.extract-branch-name.outputs.branch == 'main' || needs.extract-branch-name.outputs.branch == 'develop'}}
runs-on: ubuntu-20.04
outputs:
upload_url: ${{steps.create_release.outputs.upload_url}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -61,21 +64,79 @@ jobs:
- name: Build binary
run: poetry run pyinstaller -F --distpath ./app/bundled_app/linux --specpath ./app/build/linux --workpath ./app/build/linux --paths=./.venv/lib/python3.9/site-packages ./app/pilotcli.py -n ${{ github.sha }}

- name: Rename output file
run: mv "./app/bundled_app/linux/${{ github.sha }}" "./app/bundled_app/linux/pilotcli"

- name: Set version in env
run: poetry run echo "TAG_VERSION=`poetry version --short`" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.TAG_VERSION }}
name: Release ${{ needs.extract-branch-name.outputs.branch }} ${{ env.TAG_VERSION }}
release_name: Release ${{ needs.extract-branch-name.outputs.branch }} ${{ env.TAG_VERSION }}
body: ${{ github.event.head_commit.message }}
draft: false
prerelease: false
files: ./app/bundled_app/linux/pilotcli

- name: Upload Release Binary
id: upload-release-binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./app/bundled_app/linux/${{ github.sha }}
asset_name: pilotcli_linux
asset_content_type: application/octet-stream

push-binary-macos:
needs: [ push-binary-linux ]
if: ${{ needs.extract-branch-name.outputs.branch == 'main' || needs.extract-branch-name.outputs.branch == 'develop'}}
runs-on: macos-12
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ needs.extract-branch-name.outputs.branch }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.16

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Set up cache
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cached-poetry-dependencies.outputs.cache-hit == 'true'
run: timeout 10s poetry run pip --version || rm -rf .venv

- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Build binary
run: poetry run pyinstaller -F --distpath ./app/bundled_app/macos --specpath ./app/build/macos --workpath ./app/build/macos --paths=./.venv/lib/python3.9/site-packages ./app/pilotcli.py -n ${{ github.sha }}

- name: Upload Release Binary
id: upload-release-binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.push-binary-linux.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./app/bundled_app/macos/${{ github.sha }}
asset_name: pilotcli_macos
asset_content_type: application/octet-stream
2 changes: 1 addition & 1 deletion app/resources/custom_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class HelpPage:
page = {
'update': {
'version': '2.3.0',
'version': '2.5.0',
'1': 'The logic of normal upload and resumble are splited. '
'add new command for resumable upload as `pilotcli file resume -r manifest.json`',
'2': 'The manifest file will be output for both file/folder upload',
Expand Down
2 changes: 1 addition & 1 deletion app/services/file_manager/file_upload/upload_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def validate_zone(self):
ECustomizedError.INVALID_UPLOAD_REQUEST, True, value='upload-message is required'
)
if self.source:
source_file_info = search_item(self.project_code, AppConfig.Env.green_zone.lower(), self.source, 'file')
source_file_info = search_item(self.project_code, AppConfig.Env.core_zone.lower(), self.source, 'file')
source_file_info = source_file_info['result']
if not source_file_info:
SrvErrorHandler.customized_handle(ECustomizedError.INVALID_SOURCE_FILE, True, value=self.source)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "app"
version = "2.4.0"
version = "2.5.0a0"
description = "This service is designed to support pilot platform"
authors = ["Indoc Research"]

Expand Down