From 77745794abefd75b34d3d16c54fc0b6d373ecf80 Mon Sep 17 00:00:00 2001 From: Jim Laney Date: Tue, 19 Jan 2021 16:11:42 -0800 Subject: [PATCH] updates test/publish workflows --- examples/django-test-publish.yml | 42 +++++++++++++++++++----- examples/python-test-publish.yml | 2 +- test-django-app/action.yml | 56 -------------------------------- test-python-app/action.yml | 34 ------------------- 4 files changed, 35 insertions(+), 99 deletions(-) delete mode 100644 test-django-app/action.yml delete mode 100644 test-python-app/action.yml diff --git a/examples/django-test-publish.yml b/examples/django-test-publish.yml index 68b5828..b8bf40d 100644 --- a/examples/django-test-publish.yml +++ b/examples/django-test-publish.yml @@ -58,13 +58,39 @@ jobs: with: python-version: 3.6 - - name: Test App - uses: uw-it-aca/actions/test-django-app@v1 - with: - app_name: ${APP_NAME} - conf_path: ${CONF_PATH} - django_version: ${{ matrix.django-version }} - github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Dependencies + run: | + sudo apt-get install python-dev libxml2-dev libxmlsec1-dev + python -m pip install --upgrade pip + pip install -e . + pip install pycodestyle coverage coveralls==2.2.0 + + - name: Upgrade Django Version + run: pip install "Django~=${{ matrix.django-version }}.0" + + - name: Setup Django + run: | + django-admin startproject project . + test -f ${CONF_PATH}/urls.py && cp ${CONF_PATH}/urls.py project/ + test -f ${CONF_PATH}/settings.py && cat ${CONF_PATH}/settings.py >> project/settings.py + + - name: Run Linters + run: pycodestyle ${APP_NAME}/ + + - name: Run Migrations + run: python manage.py migrate + + - name: Run Tests + run: | + python -m compileall ${APP_NAME}/ + coverage run --source=${APP_NAME}/ manage.py test ${APP_NAME} + + - name: Test Coverage + if: matrix.django-version == 2.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: coveralls publish: if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags') @@ -83,7 +109,7 @@ jobs: python-version: '3.x' - name: Publish to PyPi - uses: uw-it-aca/actions/publish-pypi@v1 + uses: uw-it-aca/actions/publish-pypi@main with: app_name: ${APP_NAME} tag_name: ${{ github.event.release.tag_name }} diff --git a/examples/python-test-publish.yml b/examples/python-test-publish.yml index b83b5d3..bbe7f4d 100644 --- a/examples/python-test-publish.yml +++ b/examples/python-test-publish.yml @@ -83,7 +83,7 @@ jobs: python-version: '3.x' - name: Publish to PyPi - uses: uw-it-aca/actions/publish-pypi@v1 + uses: uw-it-aca/actions/publish-pypi@main with: app_name: ${APP_NAME} tag_name: ${{ github.event.release.tag_name }} diff --git a/test-django-app/action.yml b/test-django-app/action.yml deleted file mode 100644 index 0e178e7..0000000 --- a/test-django-app/action.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: 'Test' - -description: 'The test workflow for a Django app' - -inputs: - app_name: - required: true - conf_path: - required: true - django_version: - required: true - github_token: - required: true - -runs: - using: 'composite' - - steps: - - name: Install Dependencies - shell: bash - run: | - sudo apt-get install python-dev libxml2-dev libxmlsec1-dev - python -m pip install --upgrade pip - pip install -e . - pip install pycodestyle coverage coveralls==2.2.0 - - - name: Upgrade Django Version - shell: bash - run: pip install "Django~=${{ inputs.django_version }}.0" - - - name: Setup Django - shell: bash - run: | - django-admin startproject project . - test -f ${{ inputs.conf_path }}/urls.py && cp ${{ inputs.conf_path }}/urls.py project/ - test -f ${{ inputs.conf_path }}/settings.py && cat ${{ inputs.conf_path }}/settings.py >> project/settings.py - - - name: Run Linters - shell: bash - run: pycodestyle ${{ inputs.app_name }}/ - - - name: Run Migrations - shell: bash - run: python manage.py migrate - - - name: Run Tests - shell: bash - run: | - python -m compileall ${{ inputs.app_name }}/ - coverage run --source=${{ inputs.app_name }}/ manage.py test ${{ inputs.app_name }} - - - name: Record Test Results - env: - GITHUB_TOKEN: ${{ inputs.github_token }} - shell: bash - run: coveralls diff --git a/test-python-app/action.yml b/test-python-app/action.yml deleted file mode 100644 index 2bbe42a..0000000 --- a/test-python-app/action.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: 'Test' - -description: 'The test workflow for a Python app' - -inputs: - app_name: - required: true - github_token: - required: true - -runs: - using: 'composite' - - steps: - - name: Install Dependencies - shell: bash - run: | - python -m pip install --upgrade pip - pip install -e . - pip install pycodestyle commonconf nose2 coverage coveralls==2.2.0 - - - name: Run Linters - shell: bash - run: pycodestyle ${{ inputs.app_name }}/ - - - name: Run Tests - shell: bash - run: coverage run ${{ inputs.app_name }}/test.py -v - - - name: Record Test Results - env: - GITHUB_TOKEN: ${{ inputs.github_token }} - shell: bash - run: coveralls