diff --git a/.github/actions/build-install-package/action.yml b/.github/actions/build-install-package/action.yml index c715764..7b01781 100644 --- a/.github/actions/build-install-package/action.yml +++ b/.github/actions/build-install-package/action.yml @@ -4,7 +4,7 @@ inputs: package_file: description: 'Path to package setup python script.' required: false - default: 'package_setup.py' + default: 'setup.py' outputs: wheel-file: description: "Wheel filename" diff --git a/.github/workflows/DocsRebuild-Preview-Staging.yml b/.github/workflows/DocsRebuild-Preview-Staging.yml deleted file mode 100644 index af39092..0000000 --- a/.github/workflows/DocsRebuild-Preview-Staging.yml +++ /dev/null @@ -1,127 +0,0 @@ -# This workflow will Rebuild emod-api Docs triggered when changes to rst, python or requirements.txt files are intended. -# Integrated with AZURE Static Site and BLOB Storage -# it treats failures as warnings so that it builds as many docs as it can. -# TRIGGERED FROM A PR: It pushes the resulting link to the PR itself. TODO: update github token with a service account one. - -name: emod-api Documents Preview - Azure Staging -on: - push: - paths: - - '**.py' - - '**/*docs/**' - - '**/requirements.txt' - - pull_request: - branches: - - rel* - - master - -jobs: - emod-api-docs-Preview: - env: - SUBFOLDER_NAME: 'docs/_build/html' - BLOB_ENDPOINT: 'https://idmdocsstaging.z5.web.core.windows.net' - REPO_IDENTIFIER: 'idm/${{github.repository}}' - BLOB_CONTAINER_NAME: '$web' - INDEX_HTML: 'index.html' - - runs-on: ubuntu-latest - steps: - - name: Repo Checkout - uses: actions/checkout@v2 - with: - ref: ${{ github.event.inputs.branch }} - - # Environment Setup - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - # emod-api package setup - - name: Install emod-api requirements - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple - - name: Install the emod-api package - run: | - pip install -e . --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple - - # Documents building - - name: Install documentation build requirements - run: | - pip install -r docs/requirements.txt --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple - - - name: Build docs - html - no break - id: build-docs - working-directory: 'docs' - run: | - make clean - make htmlnobreak - - # # On Failure: STEP REMOVED - we will generate the links despite the results of the build. - # - name: If the build step failed - # if: ${{ failure() && steps.build-docs.conclusion == 'failure' }} - # run: | - # echo "Your build has failed, no link will be generated" - # echo "LINK_URL='No link has been generated'" >> $GITHUB_ENV - # echo "BLOB_MESSAGE='Only docs folder files were moved to the Storage Account'" >> $GITHUB_ENV - - # - # Generates Unique folder name - - name: Get current date to generate partial url link - id: date - run: | - echo "::set-output name=getdate::$(TZ='America/Los_Angeles' date +'%B %d %H:%M:%S')" - echo "THIS_RUN=$(TZ='America/Los_Angeles' date +'%B%d-%H%M%S')" >> $GITHUB_ENV - - # if: ${{steps.build-docs.outcome}} == 'success' # Removing filter to generate link only for successful builds. - - - name: Create staging documents URL - run: | - echo "Your Documents are ready!" - echo "BLOB_MESSAGE='The full Docs folder and resulting build were moved to the Storage Account. This is your link:'" >> $GITHUB_ENV - echo "DESTINATION_PATH=${BLOB_CONTAINER_NAME}/${REPO_IDENTIFIER}/${{env.THIS_RUN}}/${SUBFOLDER_NAME}" >> $GITHUB_ENV - echo "LINK_URL=${BLOB_ENDPOINT}/${REPO_IDENTIFIER}/${{env.THIS_RUN}}/${SUBFOLDER_NAME}/${INDEX_HTML}" >> $GITHUB_ENV - - # Provides the final link to the publicly accessible files. - - name: YOUR LINK - run: | - echo "${{ env.LINK_URL }}" - - # AZURE LOGIN: - - name: Azure login - uses: azure/login@v1 - with: - creds: ${{ secrets.BLOB_JSON_SERVICE_PRINCIPAL_CREDENTIALS }} - - # AZURE UPLOAD: - - name: Upload to blob storage under $web - if: always() - uses: azure/CLI@v1 - with: - inlineScript: | - az storage blob upload-batch -s ${SUBFOLDER_NAME} --account-name idmdocsstaging --auth-mode key -d ${DESTINATION_PATH} - - # AZURE PURGE CDN - - name: Purge CDN endpoint - if: always() - uses: azure/CLI@v1 - with: - inlineScript: | - az cdn endpoint purge --content-paths "/*" --profile-name "idmdocs-cdn-webprofile" --name "idmdocs-cdn-webendpoint" --resource-group "IDMDocsPreviewGroup" - # Azure logout - - name: logout - if: always() - run: | - az logout - - # Updates PR - - name: Updates PR - if: always() - uses: mshick/add-pr-comment@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - message: | - ${{ steps.date.outputs.getdate }} - Run Id: ${{github.run_id}} **[->> Link to documents preview](${{ env.LINK_URL }})** diff --git a/.github/workflows/build_test_publish.yaml b/.github/workflows/build_test_publish.yaml index 3e5db44..2a7f80b 100644 --- a/.github/workflows/build_test_publish.yaml +++ b/.github/workflows/build_test_publish.yaml @@ -33,7 +33,7 @@ jobs: name: Build and install package uses: ./.github/actions/build-install-package with: - package_file: 'package_setup.py' + package_file: 'setup.py' - name: run unit tests run: | pip install lz4 diff --git a/.github/workflows/build_test_ubuntu.yaml b/.github/workflows/build_test_ubuntu.yaml index 7014041..082e6d2 100644 --- a/.github/workflows/build_test_ubuntu.yaml +++ b/.github/workflows/build_test_ubuntu.yaml @@ -9,6 +9,7 @@ on: - dev-* - release* - master + - main jobs: build_test_ubuntu: runs-on: ubuntu-latest @@ -36,7 +37,7 @@ jobs: - name: Build and install package uses: ./.github/actions/build-install-package with: - package_file: 'package_setup.py' + package_file: 'setup.py' - name: run unit tests run: | pip install lz4 diff --git a/.github/workflows/build_test_windows.yaml b/.github/workflows/build_test_windows.yaml index a4d1544..4d91823 100644 --- a/.github/workflows/build_test_windows.yaml +++ b/.github/workflows/build_test_windows.yaml @@ -34,7 +34,7 @@ jobs: - name: Build and install package uses: ./.github/actions/build-install-package with: - package_file: 'package_setup.py' + package_file: 'setup.py' - name: run unit tests run: | pip install lz4 diff --git a/.github/workflows/emod-api-docspreview.yml b/.github/workflows/emod-api-docspreview.yml deleted file mode 100644 index 8661405..0000000 --- a/.github/workflows/emod-api-docspreview.yml +++ /dev/null @@ -1,109 +0,0 @@ -# This workflow will Rebuild emod-api Docs triggered when changes to rst, python or requirements.txt files are intended. -# The resulting documentation files get uploaded to a shared location accessible to the author of the changes. -# Resulting link is provided. -# Please note that we are running the build with a flag that treats the errors as warnings. - -name: Rebuild And Preview emod-api docs -on: - push: - paths: - - '**.py' - - '**/*docs/**' - - '**/requirements.txt' - - pull_request: - branches: - - dev-* - - release* - - master - -jobs: - emod-api-docs-Preview: - env: - BLOB_SOURCE: 'docs' - BLOB_ENDPOINT: 'https://docspreviewopt2.blob.core.windows.net' - BLOB_FIXEDPATH: 'temp/${{github.repository}}' - BLOB_CONTAINERNAME: 'idm' - INDEX_HTML: 'docs/_build/html/index.html' - #--------------------------------------------------------------------- - runs-on: ubuntu-latest - steps: - - name: Repo Checkout - uses: actions/checkout@v2 - with: - ref: ${{ github.event.inputs.branch }} - - # Environment Setup - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - # emod-api package setup - - name: Install emod-api requirements - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple - - name: Install the emod-api package - run: | - pip install -e . --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple - - # docs - - name: Install documentation build requirements - run: | - pip install -r docs/requirements.txt --index-url=https://packages.idmod.org/api/pypi/pypi-production/simple - - - name: Build docs - html - no break - id: build-docs - working-directory: 'docs' - run: | - make clean - make htmlnobreak - -# # On Failure: STEP REMOVED - we will generate the links despite the results of the build. -# - name: If the build step failed -# if: ${{ failure() && steps.build-docs.conclusion == 'failure' }} -# run: | -# echo "Your build has failed, no link will be generated" -# echo "LINK_URL='No link has been generated'" >> $GITHUB_ENV -# echo "BLOB_MESSAGE='Only docs folder files were moved to the Storage Account'" >> $GITHUB_ENV - - # On Success ------------------------------------------- - - name: Get current date - id: date - run: | - echo "::set-output name=getdate::$(TZ='America/Los_Angeles' date +'%B %d %H:%M:%S')" - echo "THIS_RUN=$(TZ='America/Los_Angeles' date +'%B%d-%H%M%S')" >> $GITHUB_ENV - - - name: Updating LINK to your DOCS - run: | - echo "Your Documents are ready!" - echo "BLOB_MESSAGE='The full Docs folder and resulting build were moved to the Storage Account. This is your link:'" >> $GITHUB_ENV - echo "DESTINATION_PATH=${BLOB_FIXEDPATH}/${{env.THIS_RUN}}" >> $GITHUB_ENV - echo "LINK_URL=${BLOB_ENDPOINT}/${BLOB_CONTAINERNAME}/${BLOB_FIXEDPATH}/${{env.THIS_RUN}}/${INDEX_HTML}" >> $GITHUB_ENV - - name: Your LINK - run: | - echo "${{ env.LINK_URL }}" - - # UPLOAD TO AZURE - - name: Azure Blob Upload - if: always() - uses: LanceMcCarthy/Action-AzureBlobUpload@v1.11.0 - with: - connection_string: ${{ secrets.CONNECTION_STRING }} - container_name: ${{env.BLOB_CONTAINERNAME}} - source_folder: ${{ env.BLOB_SOURCE }} - destination_folder: '${{ env.DESTINATION_PATH }}/docs' - clean_destination_folder: false - fail_if_source_empty: true - is_recursive: true - - # Updates PR - - name: Updates PR - if: always() - uses: mshick/add-pr-comment@v1 - env: - GITHUB_TOKEN: ${{ secrets.PR_UPDATE_TOKEN_MMG }} - with: - message: | - ${{ steps.date.outputs.getdate }} - Run Id: ${{github.run_id}} **[-> Link to documents preview](${{ env.LINK_URL }})** diff --git a/Jenkinsfile b/Jenkinsfile index 6ef725f..d9ecf08 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -49,13 +49,13 @@ podTemplate( sh 'pwd' sh 'ls -a' //sh 'python3.6 -m build' - sh 'python3.6 package_setup.py bdist_wheel' + sh 'python3.6 setup.py bdist_wheel' } stage('Install') { def curDate = sh(returnStdout: true, script: "date").trim() echo "The current date is ${curDate}" def wheelFile = sh(returnStdout: true, script: "find ./dist -name '*.whl'").toString().trim() - //def wheelFile = sh(returnStdout: true, script: "python3.6 ./.github/scripts/get_wheel_filename.py --package-file package_setup.py").toString().trim() + //def wheelFile = sh(returnStdout: true, script: "python3.6 ./.github/scripts/get_wheel_filename.py --package-file setup.py").toString().trim() echo "This is the package file: ${wheelFile}" sh "pip3.6 install $wheelFile" sh "pip3.6 freeze" diff --git a/README.md b/README.md index e5789b1..d8e888a 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ Output ## Dev Tips -- To build package: `python package_setup.py build` +- To build package: `python setup.py build` -- To build wheel (.whl): `python package_setup.py bdist_wheel` +- To build wheel (.whl): `python setup.py bdist_wheel` - To import package, you can either: - Set symlink to built module in build subdirectory - - do python package_setup.py install - - do python package_setup.py develop + - do python setup.py install + - do python setup.py develop - To install package (fill in actual version number in filename): ` pip install dist/emod_api...whl` diff --git a/emod_api_build_config.json b/emod_api_build_config.json index c5e2918..4525181 100644 --- a/emod_api_build_config.json +++ b/emod_api_build_config.json @@ -5,7 +5,7 @@ "packages": [ { "name": "emod_api", - "path": "package_setup.py", + "path": "setup.py", "test_path": ["emod_api/serialization/tests/dtkFileTests.py"], "steps": ["build", "build_wheel", "install_wheel", "test"] } diff --git a/package_setup.py b/package_setup.py deleted file mode 100644 index 27f63ea..0000000 --- a/package_setup.py +++ /dev/null @@ -1 +0,0 @@ -setup.py \ No newline at end of file