From 83d00208cd4480510b538ee311deea9f5acbc043 Mon Sep 17 00:00:00 2001 From: Philippe Virouleau <philippe.virouleau@inria.fr> Date: Mon, 4 Mar 2024 16:49:56 +0100 Subject: [PATCH] Version 1.1.1 Create the CI for an automatic push to PyPi. --- .gitlab-ci.yml | 12 +++++++++++- Makefile | 11 ++++++----- README.md | 5 +++++ submitit_oar/__init__.py | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c02e2cd..5f1c188 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ stages: - build - test - # - deploy + - publish create-venv: stage: build @@ -60,3 +60,13 @@ test_coverage: artifacts: paths: - test_results/coverage_html/ + +publish-pypi: + stage: publish + rules: + - if: $CI_COMMIT_TAG + image: python:3.8 + tags: + - grid5000-docker + script: + - make release diff --git a/Makefile b/Makefile index 2b66641..7484ca7 100644 --- a/Makefile +++ b/Makefile @@ -95,16 +95,17 @@ integration: clean_cache venv check_format lint installable test_coverage # clean_cache will make sure we download the last versions of linters. # Use `make -k integration` to run all checks even if previous fails. -release: integration +release: clean_cache venv installable echo "Releasing submitit_oar $(CURRENT_VERSION)" [ ! -d dist ] || rm -r dist # Make sure the repo is in a clean state git diff --exit-code + # Make sure we're creating a release for a tag which matches the version. + [ "`git describe --tag --exact-match $(git rev-parse HEAD)`" = "$(CURRENT_VERSION)" ] && echo "Found a tag matching current version" + # FLIT_PASSWORD is set by gitlab's variable environments. + [ -n "$(FLIT_PASSWORD)" ] || (echo "FLIT_PASSWORD not set, fix gitlab's variables, or provide it" && exit 1) # --setup-py generates a setup.py file to allow user with old # versions of pip to install it without flit. - git tag $(CURRENT_VERSION) # To have a reproducible build we use the timestamp of the last commit: # https://flit.pypa.io/en/latest/reproducible.html - SOURCE_DATE_EPOCH=`git log -n1 --format=%cd --date=unix` $(BIN)python -m flit publish --setup-py - git checkout HEAD -- README.md - git push origin $(CURRENT_VERSION) + FLIT_USERNAME="__token__" SOURCE_DATE_EPOCH=`git log -n1 --format=%cd --date=unix` $(BIN)python -m flit publish --setup-py diff --git a/README.md b/README.md index d6907aa..37e9f26 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,8 @@ assert output == 12 ``` You can try running this above example with a breakpoint at https://github.com/facebookincubator/submitit/blob/main/submitit/core/plugins.py#L33, to be sure that Submitit correctly finds the submitit_oar plugin. + +# Releasing submitit_oar + +Create a tag matching the version to release in gitlab, it should create a pipeline which will push the package to PyPi. +If you want to do this manually, populate the `FLIT_PASSWORD` environment variable with the API token, and run `make release` diff --git a/submitit_oar/__init__.py b/submitit_oar/__init__.py index c2bd7af..bf4afe9 100644 --- a/submitit_oar/__init__.py +++ b/submitit_oar/__init__.py @@ -3,4 +3,4 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -__version__ = "1.1.0" +__version__ = "1.1.1" -- GitLab