From: Nicolas Patry Date: Fri, 23 Sep 2022 09:52:20 +0000 (+0200) Subject: Create release actions. X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=c225ef7c3bfbca28de9d883393589f0be8b21204;p=safetensors.git Create release actions. --- diff --git a/.github/workflows/python-release-conda.yml b/.github/workflows/python-release-conda.yml index 89178b7..52c964a 100644 --- a/.github/workflows/python-release-conda.yml +++ b/.github/workflows/python-release-conda.yml @@ -2,8 +2,8 @@ name: Python Release - Conda on: push: - # tags: - # - python-v* + tags: + - python-v* env: ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} @@ -55,10 +55,10 @@ jobs: conda list conda-build .github/conda --python=${{ matrix.python }} - # - name: Upload to Anaconda - # shell: bash -l {0} - # run: | - # anaconda upload `conda-build .github/conda --output` --force + - name: Upload to Anaconda + shell: bash -l {0} + run: | + anaconda upload `conda-build .github/conda --output` --force build_and_package_linux: runs-on: ubuntu-18.04 @@ -126,8 +126,8 @@ jobs: conda list conda-build .github/conda --python=${{ matrix.python }} - # - name: Upload to Anaconda - # shell: bash -l {0} - # run: | - # source $HOME/miniconda/bin/activate - # anaconda upload `conda-build .github/conda --output` --force + - name: Upload to Anaconda + shell: bash -l {0} + run: | + source $HOME/miniconda/bin/activate + anaconda upload `conda-build .github/conda --output` --force diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index e119dbe..14b0f22 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -2,8 +2,8 @@ name: Python Release on: push: - # tags: - # - python-v* + tags: + - python-v* env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -148,33 +148,33 @@ jobs: cd ../../ aws s3 sync --exact-timestamps ./bindings/python/dist "s3://safetensors-releases/python/$DIST_DIR" - # Upload_package: - # name: Upload package to PyPi - # runs-on: ubuntu-latest - # needs: [create_wheels_manylinux, create_wheels_windows_32bit, create_wheels_others_64bit, create_wheels_macos_arm64] + Upload_package: + name: Upload package to PyPi + runs-on: ubuntu-latest + needs: [create_wheels_manylinux, create_wheels_windows_32bit, create_wheels_others_64bit, create_wheels_macos_arm64] - # steps: - # - uses: actions/checkout@v1 + steps: + - uses: actions/checkout@v1 - # - name: Install Python - # uses: actions/setup-python@v1 + - name: Install Python + uses: actions/setup-python@v1 - # - name: Retrieve all wheels - # shell: bash - # run: | - # pip install awscli - # aws s3 sync "s3://safetensors-releases/python/$DIST_DIR" ./bindings/python/dist + - name: Retrieve all wheels + shell: bash + run: | + pip install awscli + aws s3 sync "s3://safetensors-releases/python/$DIST_DIR" ./bindings/python/dist - # - name: Install dependencies - # run: | - # pip install setuptools wheel setuptools-rust + - name: Install dependencies + run: | + pip install setuptools wheel setuptools-rust - # - name: Create source distribution - # working-directory: ./bindings/python - # run: sh build-sdist.sh + - name: Create source distribution + working-directory: ./bindings/python + run: sh build-sdist.sh - # - name: Upload to PyPi - # working-directory: ./bindings/python - # run: | - # pip install twine - # twine upload dist/* -u __token__ -p "$PYPI_TOKEN" + - name: Upload to PyPi + working-directory: ./bindings/python + run: | + pip install twine + twine upload dist/* -u __token__ -p "$PYPI_TOKEN" diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..4beae17 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,90 @@ +## How to release + +# Before the release + +Simple checklist on how to make releases for `safetensors`. + +- Freeze `master` branch. +- Run all tests (Check CI has properly run) +- If any significant work, check benchmarks: + - `cd safetensors && cargo bench` (needs to be run on latest release tag to measure difference if it's your first time) +- Run all `transformers` tests. (`transformers` is a big user of `safetensors` we need + to make sure we don't break it, testing is one way to make sure nothing unforeseen + has been done.) + - Run all fast tests at the VERY least (not just the tokenization tests). (`RUN_PIPELINE_TESTS=1 CUDA_VISIBLE_DEVICES=-1 pytest -sv tests/`) + - When all *fast* tests work, then we can also (it's recommended) run the whole `transformers` + test suite. + - Rebase this [PR](https://github.com/huggingface/transformers/pull/16708). + This will create new docker images ready to run the tests suites with `safetensors` from the main branch. + - Wait for actions to finish + - Rebase this [PR](https://github.com/huggingface/transformers/pull/16712) + This will run the actual full test suite. + - Check the results. +- **If any breaking change has been done**, make sure the version can safely be increased for transformers users (`safetensors` version need to make sure users don't upgrade before `transformers` has). [link](https://github.com/huggingface/transformers/blob/main/setup.py#L154) + For instance `safetensors>=0.10,<0.11` so we can safely upgrade to `0.11` without impacting + current users +- Then start a new PR containing all desired code changes from the following steps. +- You will `Create release` after the code modifications are on `master`. + +# Rust + +- `safetensors` (rust, python & node) versions don't have to be in sync but it's + very common to release for all versions at once for new features. +- Edit `Cargo.toml` to reflect new version +- Edit `CHANGELOG.md`: + - Add relevant PRs that were added (python PRs do not belong for instance). + - Add links at the end of the files. +- Go to [Releases](https://github.com/huggingface/safetensors/releases) +- Create new Release: + - Mark it as pre-release + - Use new version name with a new tag (create on publish) `vX.X.X`. + - Copy paste the new part of the `CHANGELOG.md` +- ⚠️ Click on `Publish release`. This will start the whole process of building a uploading + the new version on `crates.io`, there's no going back after this +- Go to the [Actions](https://github.com/huggingface/safetensors/actions) tab and check everything works smoothly. +- If anything fails, you need to fix the CI/CD to make it work again. Since your package was not uploaded to the repository properly, you can try again. + + +# Python + +- Edit `bindings/python/setup.py` to reflect new version. +- Edit `bindings/python/py_src/safetensors/__init__.py` to reflect new version. +- Edit `CHANGELOG.md`: + - Add relevant PRs that were added (node PRs do not belong for instance). + - Add links at the end of the files. +- Go to [Releases](https://github.com/huggingface/safetensors/releases) +- Create new Release: + - Mark it as pre-release + - Use new version name with a new tag (create on publish) `python-vX.X.X`. + - Copy paste the new part of the `CHANGELOG.md` +- ⚠️ Click on `Publish release`. This will start the whole process of building a uploading + the new version on `pypi`, there's no going back after this +- Go to the [Actions](https://github.com/huggingface/safetensors/actions) tab and check everything works smoothly. +- If anything fails, you need to fix the CI/CD to make it work again. Since your package was not uploaded to the repository properly, you can try again. +- This CI/CD has 3 distinct builds, `Pypi`(normal), `conda` and `extra`. `Extra` is REALLY slow (~4h), this is normal since it has to rebuild many things, but enables the wheel to be available for old Linuxes + +# Node + +- Edit `bindings/node/package.json` to reflect new version. +- Edit `CHANGELOG.md`: + - Add relevant PRs that were added (python PRs do not belong for instance). + - Add links at the end of the files. +- Go to [Releases](https://github.com/huggingface/safetensors/releases) +- Create new Release: + - Mark it as pre-release + - Use new version name with a new tag (create on publish) `node-vX.X.X`. + - Copy paste the new part of the `CHANGELOG.md` +- ⚠️ Click on `Publish release`. This will start the whole process of building a uploading + the new version on `npm`, there's no going back after this +- Go to the [Actions](https://github.com/huggingface/safetensors/actions) tab and check everything works smoothly. +- If anything fails, you need to fix the CI/CD to make it work again. Since your package was not uploaded to the repository properly, you can try again. + + +# Testing the CI/CD for release + + +If you want to make modifications to the CI/CD of the release GH actions, you need +to : +- **Comment the part that uploads the artifacts** to `crates.io`, `PyPi` or `npm`. +- Change the trigger mecanism so it can trigger every time you push to your branch. +- Keep pushing your changes until the artifacts are properly created.