From 54c1934b8a4182dadf42714259145c49b91a0579 Mon Sep 17 00:00:00 2001 From: lfierz Date: Fri, 10 May 2024 11:19:56 +0200 Subject: [PATCH 1/4] create default driver github workflow --- .github/workflows/build-and-publish.yml | 13 ++++ .github/workflows/build-docs.yml | 11 ++++ .github/workflows/test.yml | 12 ++++ .gitlab-ci.yml | 87 ------------------------- 4 files changed, 36 insertions(+), 87 deletions(-) create mode 100644 .github/workflows/build-and-publish.yml create mode 100644 .github/workflows/build-docs.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..bfe532f --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,13 @@ +on: + push: + branches: + - master + tags: + - "^[0-9]+.[0-9]+.[0-9]+" + +jobs: + build_and_deploy: + uses: sensirion/.github/.github/workflows/driver.python.pypi_publish.yml@main + secrets: + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 0000000..4d5f98c --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,11 @@ +name: Publish Documentation +on: + push: + branches: + - master + tags: + - "^[0-9]+.[0-9]+.[0-9]+" + +jobs: + documentation: + uses: sensirion/.github/.github/workflows/driver.python.documentation.yml@main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..615fdfb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,12 @@ +name: Validate and Test Python Package +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + test: + uses: sensirion/.github/.github/workflows/driver.python.test.yml@main diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index ac05b92..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,87 +0,0 @@ -include: https://gitlab/Sensirion/Python/ci-config-python/raw/master/gitlab-ci-template-v2.yml -stages: - - prepare - - build - - deploy - -check_rst_syntax: - stage: prepare - extends: .check_rst_syntax_v2 - -check_editorconfig: - stage: prepare - extends: .check_editorconfig_v2 - - -py3p6_linux_build: - stage: build - extends: .py3p6_linux_build_v2 - variables: - PYTEST_ADDOPTS: '-m "not needs_device"' - -py3p8_linux_build: - stage: build - extends: .py3p8_linux_build_v2 - variables: - PYTEST_ADDOPTS: '-m "not needs_device"' - - -py3p8_64bit_win_build: - stage: build - extends: .py3p8_64bit_win_docker_build_v2 - variables: - PYTEST_ADDOPTS: '-m "not needs_device"' - -build_docs: - stage: build - extends: .build_docs_v2 - script: - - apt-get update && apt-get install -y graphviz - - python setup.py install - - pip install -r docs/requirements.txt - - chmod 777 ./ci/set_git_config.sh - - ./ci/set_git_config.sh - - sphinx-versioning build -r "$CI_COMMIT_REF_NAME" -w "$CI_COMMIT_REF_NAME" docs docs/_build/html - after_script: [] # overwrite after_script from template - artifacts: - paths: [docs/_build] - expire_in: 1 week - when: always - -deploy_staging: - extends: .deploy_staging_v2 - -deploy_stable: - extends: .deploy_stable_v2 - environment: - name: pypi.org - url: https://pypi.org/project/sensirion_i2c_scd30/ - before_script: - - pip install twine~=1.12.1 - script: - - PKG_VERSION=$(python setup.py --version --quiet | tail -n1) - - TAG_VERSION=$(git describe --tags) - - if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then echo "Tag Version ($TAG_VERSION) != Package Version ($PKG_VERSION)" && exit 1; fi - - twine upload dist/* - -deploy_docs: - stage: deploy - tags: [linux, docker] - image: registry.gitlab.sensirion.lokal/sensirion/docker/docker-python:3.8-20.04-2.6.0 - dependencies: [] - only: [master, tags] - script: - - apt-get update && apt-get install -y graphviz - - python setup.py install - - pip install -r docs/requirements.txt - - chmod 777 ./ci/set_git_config.sh - - ./ci/set_git_config.sh - - sphinx-versioning push docs gh-pages . - -TODO_check: - stage: prepare - image: - name: registry.gitlab.sensirion.lokal/mso-sw/drivers/docker-driver-generator:0.1.0 - tags: [linux, docker] - script: - - '! grep -rnw --exclude=.gitlab-ci.yml --exclude-dir=.git . -e "TODO"' \ No newline at end of file From 93b82461c355e268d0e2c23630c1708cda5d0c12 Mon Sep 17 00:00:00 2001 From: lfierz Date: Mon, 13 May 2024 14:55:29 +0200 Subject: [PATCH 2/4] use python 3.8 for docs build --- .github/workflows/build-docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 4d5f98c..e922fcd 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -9,3 +9,5 @@ on: jobs: documentation: uses: sensirion/.github/.github/workflows/driver.python.documentation.yml@main + with: + build-python-version: 3.8 From 4c46b2022ded1e2a425f7bd4fac2782d67300b07 Mon Sep 17 00:00:00 2001 From: LeonieFierz <56353030+LeonieFierz@users.noreply.github.com> Date: Mon, 13 May 2024 17:28:28 +0200 Subject: [PATCH 3/4] Update HW dependent test flag for CI --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 615fdfb..3b35e83 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,3 +10,5 @@ on: jobs: test: uses: sensirion/.github/.github/workflows/driver.python.test.yml@main + with: + hw-test-flag: needs_device From 74b31e26653996820ddfc8f3d314082616976a4b Mon Sep 17 00:00:00 2001 From: lfierz Date: Mon, 13 May 2024 18:07:16 +0200 Subject: [PATCH 4/4] remove unused ci scripts --- ci/set_git_config.sh | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 ci/set_git_config.sh diff --git a/ci/set_git_config.sh b/ci/set_git_config.sh deleted file mode 100644 index 860c6aa..0000000 --- a/ci/set_git_config.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# set shell settings (see https://sipb.mit.edu/doc/safe-shell/) -set -eufv -o pipefail - -# install ssh private key (set as CI variable in GitLab project settings) -mkdir -p ~/.ssh -echo "$SSH_DEPLOY_KEY" > ~/.ssh/id_rsa -chmod 400 ~/.ssh/id_rsa - -# change remote URL to SSH to allow pushing with SSH -git remote set-url --push origin "git@gitlab:${CI_PROJECT_PATH}.git" - -# set git author -git config --global user.name "GitLab-CI" -git config --global user.email "<>"