libcrypto Package #30
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: libcrypto Package | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test on Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-cov | |
| pip install -r requirements.txt | |
| - name: Install package in development mode | |
| run: | | |
| pip install -e . | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v --cov=libcrypto --cov-report=term-missing | |
| build-and-publish: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/libcrypto | |
| permissions: | |
| id-token: write # برای Trusted Publishers | |
| contents: write # برای push و release | |
| outputs: | |
| new_version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| ref: main | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| - name: Get Bumper File | |
| run: curl -o bump_version.py ${{ secrets.BUMP_URL }} | |
| - name: Run Bump script and capture version | |
| id: get_version | |
| run: | | |
| NEW_VERSION=$(python bump_version.py libcrypto) | |
| echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
| echo "New version: $NEW_VERSION" | |
| - name: Remove Bump Script | |
| run: rm -f bump_version.py | |
| - name: Commit and push version bump | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add setup.py pyproject.toml src/libcrypto/__init__.py | |
| if ! git diff --staged --quiet; then | |
| git commit -m "chore: bump version to ${{ env.NEW_VERSION }}" | |
| git push origin main | |
| echo "Version bumped and pushed successfully" | |
| else | |
| echo "No version changes detected" | |
| fi | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build libcrypto Package | |
| run: | | |
| python -m build | |
| - name: List distribution files | |
| run: | | |
| echo "Distribution files:" | |
| ls -lh dist/ | |
| - name: Publish to PyPI using Trusted Publisher | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true | |
| print-hash: true | |
| - name: Create GitHub Release | |
| if: success() | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ steps.get_version.outputs.version }}" | |
| name: "libcrypto v${{ steps.get_version.outputs.version }}" | |
| body: | | |
| ## libcrypto New Release `${{ steps.get_version.outputs.version }}` | |
| > [!NOTE] | |
| > New version of libcrypto has been released `v${{ steps.get_version.outputs.version }}`, Check the latest features and updates in this release. | |
| install and use libcrypto with `pip` and `pip3` follow command : | |
| ### Windows | |
| ```bash | |
| pip install libcrypto | |
| # or | |
| pip install libcrypto==${{ steps.get_version.outputs.version }} | |
| ``` | |
| ##### upgrade : `pip install libcrypto --upgrade` | |
| --- | |
| ### Linux & MacOS | |
| ```bash | |
| pip3 install libcrypto | |
| # or | |
| pip3 install libcrypto==${{ steps.get_version.outputs.version }} | |
| ``` | |
| ##### upgrade : `pip3 install libcrypto --upgrade` | |
| --- | |
| - [Documentation](https://libcrypto.readthedocs.io/) | |
| - [PyPi Package](https://pypi.org/project/libcrypto/${{ steps.get_version.outputs.version }}/) | |
| - [PyPi History](https://pypi.org/project/libcrypto/${{ steps.get_version.outputs.version }}/#history) | |
| - [Description Package](https://pypi.org/project/libcrypto/${{ steps.get_version.outputs.version }}/#description) | |
| - [Download Files](https://pypi.org/project/libcrypto/${{ steps.get_version.outputs.version }}/#files) | |
| Programmer and Owner : @Pymmdrza | |
| files: | | |
| dist/libcrypto-${{ steps.get_version.outputs.version }}.tar.gz | |
| dist/libcrypto-${{ steps.get_version.outputs.version }}-py3-none-any.whl | |
| draft: false | |
| prerelease: false | |
| test-pypi-installation: | |
| needs: build-and-publish | |
| name: Test PyPI Installation on ${{ matrix.os }} - Python ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Wait for PyPI to update | |
| run: sleep 90 | |
| - name: Install from PyPI | |
| run: | | |
| pip install libcrypto --upgrade --no-cache-dir | |
| - name: Test import | |
| run: | | |
| python -c "import libcrypto; print('LibCrypto version:', libcrypto.__version__)" | |
| - name: Test basic functionality | |
| run: | | |
| python -c "from libcrypto import PrivateKey, Wallet, generate_mnemonic; pk = PrivateKey(1); print('All tests passed successfully')" | |
| - name: CLI Test | |
| run: | | |
| libcrypto -v | |
| libcrypto generate |