Merge pull request #78 from mludvig/dependabot/uv/urllib3-2.6.3 #72
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: ./dev.sh install | |
| - name: Run code quality checks | |
| run: ./dev.sh check | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up Python | |
| run: uv python install 3.10 | |
| - name: Install dependencies | |
| run: ./dev.sh install | |
| - name: Build package | |
| run: ./dev.sh build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| build-windows: | |
| runs-on: windows-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install package and PyInstaller | |
| run: uv pip install --system -e ".[dev]" pyinstaller || uv pip install --system -e . pyinstaller | |
| - name: Build executables | |
| run: | | |
| $tools = @( | |
| @{ name = "ec2-session"; script = "ssm_tools/ssm_session_cli.py" }, | |
| @{ name = "ec2-ssh"; script = "ssm_tools/ssm_ssh_cli.py" }, | |
| @{ name = "ecs-session"; script = "ssm_tools/ecs_session_cli.py" }, | |
| @{ name = "ssm-port-forward"; script = "ssm_tools/ssm_port_forward_cli.py" } | |
| ) | |
| foreach ($tool in $tools) { | |
| pyinstaller --onefile --name $tool.name ` | |
| --collect-submodules botocore ` | |
| --collect-data botocore ` | |
| $tool.script | |
| } | |
| shell: pwsh | |
| - name: Create zip bundle | |
| run: | | |
| $version = python -c "import ssm_tools; print(ssm_tools.__version__)" | |
| Compress-Archive -Path dist\*.exe -DestinationPath "dist\aws-ssm-tools-windows-$version.zip" | |
| shell: pwsh | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-dist | |
| path: dist/ | |
| - name: Attach to GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/*.zip | |
| publish: | |
| needs: [test, build] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up Python | |
| run: uv python install 3.10 | |
| - name: Install dependencies | |
| run: ./dev.sh install | |
| - name: Verify version matches tag | |
| run: | | |
| tag_version="${{ github.ref_name }}" | |
| # Remove 'v' prefix if present | |
| tag_version="${tag_version#v}" | |
| package_version=$(./dev.sh version) | |
| echo "Tag version: $tag_version" | |
| echo "Package version: $package_version" | |
| if [ "$tag_version" != "$package_version" ]; then | |
| echo "Error: Tag version ($tag_version) does not match package version ($package_version)" | |
| exit 1 | |
| fi | |
| - name: Build and publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: ./dev.sh upload |