Reset conda build number #213
This file contains 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: "Conda Update" | |
on: | |
schedule: | |
- cron: '0 10 * * 6' # everyday at 10am | |
push: | |
branches: [main, ] | |
jobs: | |
conda-update: | |
name: Update requirements.txt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install and Setup | |
run: | | |
set -x | |
python -m pip install -U pip setuptools wheel packaging | |
python -m pip install -e .[all] | |
#python -m pip install pathlib2 typing_extensions | |
- name: Setup Conda Distribution | |
run: | | |
export PCAPKIT_DEVMODE=1 | |
export PCAPKIT_VERBOSE=1 | |
python util/conda-dist.py | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v17 | |
id: verify-changed-files | |
- name: Bump Version | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
python util/conda-build.py | |
- name: Commit Changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -am"Bumped build to $(cat conda/build) | |
Updated conda distribution at $(date). The following files have been changed: | |
${{ steps.verify-changed-files.outputs.changed_files }}" | |
- name: Push Changes | |
uses: ad-m/github-push-action@master | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Get Version | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
id: get_version | |
run: | | |
set -ex | |
echo "PCAPKIT_VERSION=$(python -c 'import pcapkit; print(pcapkit.__version__)')" >> $GITHUB_OUTPUT | |
echo "PCAPKIT_CONDA_LABEL=$(python -c 'import pcapkit, pkg_resources; print("dev" if pkg_resources.parse_version(pcapkit.__version__).is_prerelease else "main")')" >> $GITHUB_OUTPUT | |
echo "PCAPKIT_BUILD=$(cat conda/build)" >> $GITHUB_OUTPUT | |
outputs: | |
CONDA_CHANGED: ${{ steps.verify-changed-files.outputs.files_changed }} | |
PCAPKIT_VERSION: ${{ steps.get_version.outputs.PCAPKIT_VERSION }} | |
PCAPKIT_CONDA_LABEL: ${{ steps.get_version.outputs.PCAPKIT_CONDA_LABEL }} | |
PCAPKIT_BUILD: ${{ steps.get_version.outputs.PCAPKIT_BUILD }} | |
conda-tag: | |
name: Conda Tag | |
runs-on: ubuntu-latest | |
needs: [ conda-update ] | |
if: needs.conda-update.outputs.CONDA_CHANGED == 'true' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PYPCAPKIT }} | |
fetch-depth: 0 | |
- name: Create Tag | |
run: | | |
set -x | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git pull | |
git tag "conda-${{ needs.conda-update.outputs.PCAPKIT_VERSION }}+${{ needs.conda-update.outputs.PCAPKIT_BUILD }}" -m"Conda Build" | |
- name: Push Tag | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.PYPCAPKIT }} | |
atomic: false | |
tags: true | |
conda-dist: | |
name: Conda deployment of package for platform ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
needs: [ conda-tag, conda-update ] | |
if: needs.conda-update.outputs.CONDA_CHANGED == 'true' | |
strategy: | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
# - windows-latest # skip for now | |
python-version: | |
#- "3.7" # skip for now | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: conda-${{ needs.conda-update.outputs.PCAPKIT_VERSION }}+${{ needs.conda-update.outputs.PCAPKIT_BUILD }} | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install and Setup | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
set -x | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -e .[all] | |
python -m pip install pathlib2 typing_extensions | |
- name: Install and Setup (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -e .[all] | |
python -m pip install pathlib2 typing_extensions | |
- name: Setup Conda Distribution | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
set -x | |
mkdir -p conda/wheels | |
python -m pip download -r conda/requirements.txt -d conda/wheels | |
- name: Setup Conda Distribution (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
mkdir -p conda/wheels | |
python -m pip download -r conda/requirements.txt -d conda/wheels | |
- name: Conda environment creation and activation | |
uses: conda-incubator/setup-miniconda@v3 | |
env: | |
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }} | |
PCAPKIT_BUILD: ${{ needs.conda-update.outputs.PCAPKIT_BUILD }} | |
with: | |
python-version: ${{ matrix.python-version }} | |
environment-file: conda/conda-build.yaml # Path to the build conda environment | |
auto-update-conda: false | |
auto-activate-base: false | |
show-channel-urls: true | |
- name: Build and upload the conda packages (macOS) | |
uses: uibcdf/[email protected] | |
if: ${{ matrix.os == 'macos-latest' }} | |
env: | |
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }} | |
PCAPKIT_BUILD: ${{ needs.conda-update.outputs.PCAPKIT_BUILD }} | |
with: | |
meta_yaml_dir: conda/pypcapkit | |
python-version: ${{ matrix.python-version }} # Values previously defined in `matrix` | |
platform_osx-64: true | |
overwrite: true | |
user: jarryshaw | |
label: ${{ needs.conda-update.outputs.PCAPKIT_CONDA_LABEL }} | |
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret | |
- name: Build and upload the conda packages (Ubuntu) | |
uses: uibcdf/[email protected] | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
env: | |
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }} | |
PCAPKIT_BUILD: ${{ needs.conda-update.outputs.PCAPKIT_BUILD }} | |
with: | |
meta_yaml_dir: conda/pypcapkit | |
python-version: ${{ matrix.python-version }} # Values previously defined in `matrix` | |
platform_linux-64: true | |
overwrite: true | |
user: jarryshaw | |
label: ${{ needs.conda-update.outputs.PCAPKIT_CONDA_LABEL }} | |
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret | |
- name: Build and upload the conda packages (Windows) | |
uses: uibcdf/[email protected] | |
if: ${{ matrix.os == 'windows-latest' }} | |
env: | |
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }} | |
PCAPKIT_BUILD: ${{ needs.conda-update.outputs.PCAPKIT_BUILD }} | |
with: | |
meta_yaml_dir: conda/pypcapkit | |
python-version: ${{ matrix.python-version }} # Values previously defined in `matrix` | |
platform_win-64: true | |
overwrite: true | |
user: jarryshaw | |
label: ${{ needs.conda-update.outputs.PCAPKIT_CONDA_LABEL }} | |
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret | |
- name: Upload package to GitHub Release | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
uses: ncipollo/[email protected] | |
with: | |
allowUpdates: true | |
artifacts: | | |
/tmp/compilation-*/**/*.tar.bz2 | |
tag: "v${{ needs.conda-update.outputs.PCAPKIT_VERSION }}" | |
token: "${{ secrets.GITHUB_TOKEN }}" |