Skip to content

Migrate from pipenv to uv #10

Migrate from pipenv to uv

Migrate from pipenv to uv #10

Workflow file for this run

# Test workflow for the Launchable CLI
# Runs tests, linting, type checking, and build verification
name: Test
on:
workflow_dispatch:
push:
branches: [ main ]
paths-ignore:
- 'WORKSPACE'
- 'src/**'
pull_request:
paths-ignore:
- 'WORKSPACE'
- 'src/**'
schedule:
# This job runs at 00:00 JST every day.
- cron: '0 9 * * *'
env:
LAUNCHABLE_ORGANIZATION: "launchableinc"
LAUNCHABLE_WORKSPACE: "cli"
GITHUB_PULL_REQUEST_URL: ${{ github.event.pull_request.html_url }}
GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up JDK 1.8
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
java-version: 8
distribution: 'temurin'
- name: Install dependencies
run: uv sync --dev
- name: Test package build
run: uv build
- name: Type check
run: uv run poe type
- name: Lint with flake8
run: uv run poe lint
- name: Pull request validation
run: |
# Install Launchable CLI from this repo's code as a global tool
uv tool install .
set -x
launchable verify
# Tell Launchable about the build you are producing and testing
launchable record build --name ${GITHUB_RUN_ID}
launchable record session --build ${GITHUB_RUN_ID} --flavor os=${{ matrix.os }} --flavor python=$(cat .python-version) > session.txt
# Find 25% of the relevant tests to run for this change
find tests -name test_*.py | grep -v tests/data | launchable subset --target 25% --session $(cat session.txt) --rest launchable-remainder.txt file > subset.txt
function record() {
# Record test results
LAUNCHABLE_SLACK_NOTIFICATION=true launchable record tests --session $(cat session.txt) file test-results/*.xml
}
trap record EXIT
# Test subset of tests
uv run poe test-xml $(tr '\r\n' '\n' < subset.txt)
# Test rest of tests
uv run poe test-xml $(tr '\r\n' '\n' < launchable-remainder.txt)
shell: bash