From 8c62d8b7a86c8c449807c9ee9a90a26cff6031c2 Mon Sep 17 00:00:00 2001 From: chaduhduh Date: Fri, 4 Oct 2024 10:02:56 -0700 Subject: [PATCH] debugging workflow errors, refactors workflow files --- .github/workflows/datalab_pip.yml | 55 ----------------------------- .github/workflows/generate_docs.yml | 2 +- .github/workflows/release_pip.yml | 38 ++++++++++++++++++++ .github/workflows/test.yml | 27 ++++++++++++++ 4 files changed, 66 insertions(+), 56 deletions(-) delete mode 100644 .github/workflows/datalab_pip.yml create mode 100644 .github/workflows/release_pip.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/datalab_pip.yml b/.github/workflows/datalab_pip.yml deleted file mode 100644 index 708fb80..0000000 --- a/.github/workflows/datalab_pip.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Build, test, deploy pip package of datalab cmd line client - -on: - push: - branches: - - master - release: - types: [ published ] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.9', '3.10', '3.11'] - - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --upgrade pip - pip install --upgrade setuptools wheel twine build - - name: Build pip package - run: | - rm -rf dist/ build/ datalab_client.egg-info/ astro_datalab.egg-info/ - python -m build - - - name: Print release event details - if: github.event_name == 'release' - run: | - echo "Event: ${{ github.event_name }}" - echo "Action: ${{ github.event.action }}" - - name: Upload package to PyPI - # TODO: - # break this workflow in two jobs, make the first job to output the build directory to a - # place the next job can upload from. - # - # Only execute this step if it is a release and just do it for one python version - if: ${{ matrix.python-version == '3.11' }} && github.event_name == 'release' && github.event.action == 'published' - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - # for testing purposes set the PYPI_REPO_URL to https://test.pypi.org/legacy/ - PYPI_REPO_URL: '' - run: | - if [ -z "${{ env.PYPI_REPO_URL }}" ]; then - twine upload --verbose dist/* - else - twine upload --verbose --repository-url "${{ env.PYPI_REPO_URL }}" dist/* - fi - diff --git a/.github/workflows/generate_docs.yml b/.github/workflows/generate_docs.yml index b4cca1d..1745532 100644 --- a/.github/workflows/generate_docs.yml +++ b/.github/workflows/generate_docs.yml @@ -1,6 +1,6 @@ # Builds and deploys the python documentation using sphinx. Live documentation # is available from the main Astro Data Lab website. -name: Deploy Documentation +name: Docs env: # these are defaults in case these values do not get set at runtime diff --git a/.github/workflows/release_pip.yml b/.github/workflows/release_pip.yml new file mode 100644 index 0000000..f4e9de8 --- /dev/null +++ b/.github/workflows/release_pip.yml @@ -0,0 +1,38 @@ +name: Release + +on: + release: + types: [released] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install dependencies + run: pip install --upgrade setuptools wheel twine build + + - name: Build pip package + run: | + rm -rf dist/ build/ datalab_client.egg-info/ astro_datalab.egg-info/ + python -m build + + - name: Upload package to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + # for testing purposes set the PYPI_REPO_URL to https://test.pypi.org/legacy/ + #TODO: remove this test setting before merge + PYPI_REPO_URL: 'https://test.pypi.org/legacy/' + run: | + if [ -z "${{ env.PYPI_REPO_URL }}" ]; then + twine upload --verbose dist/* + else + twine upload --verbose --repository-url "${{ env.PYPI_REPO_URL }}" dist/* + fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..012d96c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Tests and Checks + +on: + push: + branches: + +jobs: + build-check: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --upgrade pip + pip install --upgrade setuptools wheel twine build + - name: Build pip package + run: | + rm -rf dist/ build/ datalab_client.egg-info/ astro_datalab.egg-info/ + python -m build