From 7315bb346f7afe614a1e2f0c196de970870d120b Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Mon, 31 Oct 2022 15:46:30 -0600 Subject: [PATCH 1/5] Add nuget package creation --- .github/workflows/ci.yml | 110 ++++++++++++++++++------------- .gitignore | 4 ++ ansys/api/additive/VERSION | 2 +- csharp/Ansys.Api.Additive.csproj | 22 +++++++ csharp/nuget.config | 9 +++ 5 files changed, 102 insertions(+), 45 deletions(-) create mode 100644 csharp/Ansys.Api.Additive.csproj create mode 100644 csharp/nuget.config diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e062491..3acfcbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,49 +15,49 @@ env: DEFINITION_VERSION: "v0" jobs: - build: - name: Build package - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} - - # Uncomment once the proto files are stable enough on their side - - # - name: Run protolint - # uses: plexsystems/protolint-action@v0.7.0 - # with: - # configDirectory: . - - - name: Install build requirements - run: | - pip install -U pip - pip install build - - - name: Build - run: python -m build - - - name: Install - run: pip install dist/*.whl - - - name: Test import - run: | - mkdir tmp - cd tmp - python -c "import ${{ env.PACKAGE_NAME }}.${{ env.DEFINITION_VERSION }}; print('Sucessfully imported ${{ env.PACKAGE_NAME}}.${{ env.DEFINITION_VERSION }}')" - python -c "from ${{ env.PACKAGE_NAME }} import __version__; print(__version__)" - - - name: Upload packages - uses: actions/upload-artifact@v3 - with: - name: ansys-api-additive-packages - path: dist/ - retention-days: 7 - - Release: + # build: + # name: Build python package + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.MAIN_PYTHON_VERSION }} + + # # Uncomment once the proto files are stable enough on their side + + # # - name: Run protolint + # # uses: plexsystems/protolint-action@v0.7.0 + # # with: + # # configDirectory: . + + # - name: Install build requirements + # run: | + # pip install -U pip + # pip install build + + # - name: Build + # run: python -m build + + # - name: Install + # run: pip install dist/*.whl + + # - name: Test import + # run: | + # mkdir tmp + # cd tmp + # python -c "import ${{ env.PACKAGE_NAME }}.${{ env.DEFINITION_VERSION }}; print('Sucessfully imported ${{ env.PACKAGE_NAME}}.${{ env.DEFINITION_VERSION }}')" + # python -c "from ${{ env.PACKAGE_NAME }} import __version__; print(__version__)" + + # - name: Upload packages + # uses: actions/upload-artifact@v3 + # with: + # name: ansys-api-additive-packages + # path: dist/ + # retention-days: 7 + + release: if: github.event_name == 'push' && contains(github.ref, 'refs/tags') needs: [build] runs-on: ubuntu-latest @@ -90,7 +90,7 @@ jobs: twine upload --skip-existing ./**/*.tar.gz env: TWINE_USERNAME: PAT - TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} + TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload - name: Release @@ -101,3 +101,25 @@ jobs: ./**/*.whl ./**/*.tar.gz ./**/*.pdf + + nuget: + # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + if: github.event_name == 'push' + name: build, pack & publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0 + + # Publish + - name: build and publish nuget package + run: | + dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ansys/index.json" + version=$(find . -name VERSION -exec cat "{}" \;) + rm -rf nuget_package + dotnet pack csharp/Ansys.Api.Additive.csproj -c Release -o nuget_package -p:PackageVersion=${version} + dotnet nuget push nuget_package/*.nupkg --source github diff --git a/.gitignore b/.gitignore index f11e21a..4889420 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,7 @@ venv/ # autogenerated Python code *pb2*.py *pb2*.pyi + +# Compiled code +bin/ +obj/ diff --git a/ansys/api/additive/VERSION b/ansys/api/additive/VERSION index 6da28dd..195b2fc 100644 --- a/ansys/api/additive/VERSION +++ b/ansys/api/additive/VERSION @@ -1 +1 @@ -0.1.1 \ No newline at end of file +0.0.0-test0 diff --git a/csharp/Ansys.Api.Additive.csproj b/csharp/Ansys.Api.Additive.csproj new file mode 100644 index 0000000..e188e68 --- /dev/null +++ b/csharp/Ansys.Api.Additive.csproj @@ -0,0 +1,22 @@ + + + + netstandard2.0 + Ansys.Api.Additive + Additive Developers + Ansys Inc. + Protobuf definitions for Additive API + https://github.com/ansys/ansys-api-additive + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + diff --git a/csharp/nuget.config b/csharp/nuget.config new file mode 100644 index 0000000..4656ca2 --- /dev/null +++ b/csharp/nuget.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file From 7c7875442b997b7b6440355bcc9060e11d2be946 Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Mon, 31 Oct 2022 15:48:44 -0600 Subject: [PATCH 2/5] Test ci pipeline --- .github/workflows/ci.yml | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3acfcbd..576d445 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,50 +57,50 @@ jobs: # path: dist/ # retention-days: 7 - release: - if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - needs: [build] - runs-on: ubuntu-latest - steps: - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ env.MAIN_PYTHON_VERSION }} + # release: + # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + # needs: [build] + # runs-on: ubuntu-latest + # steps: + # - name: Set up Python + # uses: actions/setup-python@v2 + # with: + # python-version: ${{ env.MAIN_PYTHON_VERSION }} - - uses: actions/download-artifact@v3 + # - uses: actions/download-artifact@v3 - - name: Display structure of downloaded files - run: ls -R + # - name: Display structure of downloaded files + # run: ls -R - # uncomment the following section to permit upload to public PyPI + # # uncomment the following section to permit upload to public PyPI - # - name: Upload to Public PyPi - # run: | - # pip install twine - # twine upload --skip-existing ./**/*.whl - # twine upload --skip-existing ./**/*.tar.gz - # env: - # TWINE_USERNAME: __token__ - # TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + # # - name: Upload to Public PyPi + # # run: | + # # pip install twine + # # twine upload --skip-existing ./**/*.whl + # # twine upload --skip-existing ./**/*.tar.gz + # # env: + # # TWINE_USERNAME: __token__ + # # TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - - name: Upload to Private PyPi - run: | - pip install twine - twine upload --skip-existing ./**/*.whl - twine upload --skip-existing ./**/*.tar.gz - env: - TWINE_USERNAME: PAT - TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} - TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload - - - name: Release - uses: softprops/action-gh-release@v1 - with: - generate_release_notes: true - files: | - ./**/*.whl - ./**/*.tar.gz - ./**/*.pdf + # - name: Upload to Private PyPi + # run: | + # pip install twine + # twine upload --skip-existing ./**/*.whl + # twine upload --skip-existing ./**/*.tar.gz + # env: + # TWINE_USERNAME: PAT + # TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} + # TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload + + # - name: Release + # uses: softprops/action-gh-release@v1 + # with: + # generate_release_notes: true + # files: | + # ./**/*.whl + # ./**/*.tar.gz + # ./**/*.pdf nuget: # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') From ca832b866d9875746ee17222339ee1294632a689 Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Mon, 31 Oct 2022 15:50:38 -0600 Subject: [PATCH 3/5] Test ci pipeline --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 576d445..2b664cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,7 +104,6 @@ jobs: nuget: # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - if: github.event_name == 'push' name: build, pack & publish runs-on: ubuntu-latest steps: From 9f9348b0175dfe4521128cac9ea610f2da44ddd5 Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Mon, 31 Oct 2022 15:52:46 -0600 Subject: [PATCH 4/5] Test ci pipeline --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b664cd..49daf30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,7 +112,7 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0 + dotnet-version: 6.0.x # Publish - name: build and publish nuget package From 6281d79372b4ea57a2c23a00c32832e0be34f798 Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Mon, 31 Oct 2022 15:58:52 -0600 Subject: [PATCH 5/5] Bump version --- .github/workflows/ci.yml | 174 ++++++++++++++++++------------------- ansys/api/additive/VERSION | 2 +- 2 files changed, 88 insertions(+), 88 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49daf30..f35e73b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,95 +15,95 @@ env: DEFINITION_VERSION: "v0" jobs: - # build: - # name: Build python package - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Setup Python - # uses: actions/setup-python@v4 - # with: - # python-version: ${{ env.MAIN_PYTHON_VERSION }} - - # # Uncomment once the proto files are stable enough on their side - - # # - name: Run protolint - # # uses: plexsystems/protolint-action@v0.7.0 - # # with: - # # configDirectory: . - - # - name: Install build requirements - # run: | - # pip install -U pip - # pip install build - - # - name: Build - # run: python -m build - - # - name: Install - # run: pip install dist/*.whl - - # - name: Test import - # run: | - # mkdir tmp - # cd tmp - # python -c "import ${{ env.PACKAGE_NAME }}.${{ env.DEFINITION_VERSION }}; print('Sucessfully imported ${{ env.PACKAGE_NAME}}.${{ env.DEFINITION_VERSION }}')" - # python -c "from ${{ env.PACKAGE_NAME }} import __version__; print(__version__)" - - # - name: Upload packages - # uses: actions/upload-artifact@v3 - # with: - # name: ansys-api-additive-packages - # path: dist/ - # retention-days: 7 - - # release: - # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') - # needs: [build] - # runs-on: ubuntu-latest - # steps: - # - name: Set up Python - # uses: actions/setup-python@v2 - # with: - # python-version: ${{ env.MAIN_PYTHON_VERSION }} - - # - uses: actions/download-artifact@v3 - - # - name: Display structure of downloaded files - # run: ls -R - - # # uncomment the following section to permit upload to public PyPI - - # # - name: Upload to Public PyPi - # # run: | - # # pip install twine - # # twine upload --skip-existing ./**/*.whl - # # twine upload --skip-existing ./**/*.tar.gz - # # env: - # # TWINE_USERNAME: __token__ - # # TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - - # - name: Upload to Private PyPi - # run: | - # pip install twine - # twine upload --skip-existing ./**/*.whl - # twine upload --skip-existing ./**/*.tar.gz - # env: - # TWINE_USERNAME: PAT - # TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} - # TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload - - # - name: Release - # uses: softprops/action-gh-release@v1 - # with: - # generate_release_notes: true - # files: | - # ./**/*.whl - # ./**/*.tar.gz - # ./**/*.pdf + build: + name: Build python package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + # Uncomment once the proto files are stable enough on their side + + # - name: Run protolint + # uses: plexsystems/protolint-action@v0.7.0 + # with: + # configDirectory: . + + - name: Install build requirements + run: | + pip install -U pip + pip install build + + - name: Build + run: python -m build + + - name: Install + run: pip install dist/*.whl + + - name: Test import + run: | + mkdir tmp + cd tmp + python -c "import ${{ env.PACKAGE_NAME }}.${{ env.DEFINITION_VERSION }}; print('Sucessfully imported ${{ env.PACKAGE_NAME}}.${{ env.DEFINITION_VERSION }}')" + python -c "from ${{ env.PACKAGE_NAME }} import __version__; print(__version__)" + + - name: Upload packages + uses: actions/upload-artifact@v3 + with: + name: ansys-api-additive-packages + path: dist/ + retention-days: 7 + + release: + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ env.MAIN_PYTHON_VERSION }} + + - uses: actions/download-artifact@v3 + + - name: Display structure of downloaded files + run: ls -R + + # uncomment the following section to permit upload to public PyPI + + # - name: Upload to Public PyPi + # run: | + # pip install twine + # twine upload --skip-existing ./**/*.whl + # twine upload --skip-existing ./**/*.tar.gz + # env: + # TWINE_USERNAME: __token__ + # TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + + - name: Upload to Private PyPi + run: | + pip install twine + twine upload --skip-existing ./**/*.whl + twine upload --skip-existing ./**/*.tar.gz + env: + TWINE_USERNAME: PAT + TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} + TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload + + - name: Release + uses: softprops/action-gh-release@v1 + with: + generate_release_notes: true + files: | + ./**/*.whl + ./**/*.tar.gz + ./**/*.pdf nuget: - # if: github.event_name == 'push' && contains(github.ref, 'refs/tags') + if: github.event_name == 'push' && contains(github.ref, 'refs/tags') name: build, pack & publish runs-on: ubuntu-latest steps: diff --git a/ansys/api/additive/VERSION b/ansys/api/additive/VERSION index 195b2fc..d917d3e 100644 --- a/ansys/api/additive/VERSION +++ b/ansys/api/additive/VERSION @@ -1 +1 @@ -0.0.0-test0 +0.1.2