Skip to content

Send Connect test instance logs to STDOUT for CI jobs to show the log in case of job failure #2778

Send Connect test instance logs to STDOUT for CI jobs to show the log in case of job failure

Send Connect test instance logs to STDOUT for CI jobs to show the log in case of job failure #2778

Workflow file for this run

name: main
on:
push:
branches: [main]
tags: ['*']
schedule:
- cron: "0 09 * * *" # Runs 11 AM UTC == 2 AM PDT
pull_request:
branches: [main]
workflow_dispatch:
permissions:
id-token: write
contents: write
pull-requests: write
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
include:
- os: macos-latest
python-version: '3.9'
- os: windows-latest
python-version: '3.9'
runs-on: ${{ matrix.os }}
name: test (py${{ matrix.python-version }} ${{ matrix.os }})
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install '.[test]'
- run: pip freeze
- run: make lint
- run: rsconnect version
- run: make test-${{ matrix.python-version }}
- if: github.event_name == 'pull_request' && matrix.python-version == '3.8'
uses: orgoro/coverage@v3
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
prerelease-test:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: 3.8.x
- run: pip install --pre '.[test]'
- run: pip freeze
- run: make lint
- run: rsconnect version
- run: make test-3.8
distributions:
needs: test
strategy:
matrix:
package_name: ["rsconnect_python", "rsconnect"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: 3.8.x
- name: Install uv # see scripts/temporary-rename
uses: astral-sh/setup-uv@v6
- run: pip install -e '.[test]'
- run: pip freeze
- run: make dist
id: create_dist
env:
PACKAGE_NAME: ${{ matrix.package_name }}
- uses: actions/upload-artifact@v4
with:
name: distributions
path: dist/
if: matrix.package_name == 'rsconnect_python'
- run: pip install -vvv ${{ steps.create_dist.outputs.whl }}
- run: rsconnect version
- run: rsconnect --help
- name: create github release
uses: softprops/action-gh-release@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.package_name == 'rsconnect_python'
with:
files: |
dist/*.whl
token: ${{ secrets.GITHUB_TOKEN }}
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
docs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: 3.12
- name: build docs
run: make docs
- uses: actions/upload-artifact@v4
with:
name: docs
path: site/
- uses: aws-actions/configure-aws-credentials@v4
id: creds
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: make sync-latest-docs-to-s3
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.DOCS_AWS_ROLE }}
aws-region: us-east-1
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: make promote-docs-in-s3
test-rsconnect:
name: "Integration tests against latest Connect"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.12.4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r vetiver-testing/vetiver-requirements.txt
python -m pip install '.[test]'
- name: Run Posit Connect
run: |
docker compose up --build -d
pip freeze > requirements.txt
make dev
env:
RSC_LICENSE: ${{ secrets.RSC_LICENSE }}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Get logs in case of failure
run: |
docker compose logs rsconnect
if: ${{ failure() }}
# NOTE: edited to run checks for python package
- name: Run tests
run: |
pytest tests/test_main_system_caches.py
pytest -m 'vetiver'
test-connect:
needs: distributions
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
PY_VERSION:
- 3.11.13
- 3.12.11
steps:
- uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Checkout the rsconnect-python tests from Connect
- uses: actions/checkout@v4
with:
repository: rstudio/connect
path: 'test/connect-rsconnect-python'
sparse-checkout: |
test/rsconnect-python
tools/dev
examples
sparse-checkout-cone-mode: false
token: ${{ secrets.CONNECT_PAT }}
- name: Delete dotnet to save space
run: sudo rm -rf /usr/share/dotnet
- name: Build docker container-image
run: |
cd test/connect-rsconnect-python/test/rsconnect-python/
docker compose --profile rsconnect build
- name: Restore dist
uses: actions/download-artifact@v4
with:
name: distributions
path: dist/
- name: Run rsconnect-python Tests
env:
CONNECT_LICENSE: "${{ secrets.RSC_LICENSE }}"
PY_VERSION: ${{ matrix.PY_VERSION }}
TEST_SUBSET: "CI"
RSC_AUTOMATION_PAT: "${{ secrets.CONNECT_PAT }}"
ADMIN_API_KEY: "${{ secrets.ADMIN_API_KEY }}"
QUARTO_VERSION: "1.4.546"
# This allows us to start Connect separately in our own docker container
CONNECT_SERVER: "http://localhost:3939"
remote: "yes"
run: |
cd integration-testing
docker compose pull connect
docker compose up -d connect
just ../test/connect-rsconnect-python/test/rsconnect-python/test-rsconnect-python-repo
# Videos are captured whether the suite fails or passes
- name: Save videos
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos_${{ matrix.PY_VERSION }}_native
path: test/connect-rsconnect-python/cypress/videos
if-no-files-found: ignore
# Screenshots are only captured on failure
- name: Save screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots_${{ matrix.PY_VERSION }}_native
path: test/connect-rsconnect-python/cypress/screenshots
if-no-files-found: ignore