From 2d342490ac59b77edac91eb042ae19648ad8b5c2 Mon Sep 17 00:00:00 2001 From: Pascal Sachs Date: Fri, 19 Apr 2024 15:37:09 +0200 Subject: [PATCH] Migrate to github workflows Remove circle-ci and gitlab-ci and use github workflows --- .circleci/config.yml | 84 ------------------- .github/workflows/check.yml | 21 +++++ .gitlab-ci.yml | 33 -------- .../arduino_sps30_example.ino | 22 ++--- tests/sps30-test.cpp | 16 +++- 5 files changed, 44 insertions(+), 132 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/check.yml delete mode 100644 .gitlab-ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2c41e4d..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,84 +0,0 @@ -version: 2 - -jobs: - build: - docker: - - image: sensirion/embedded-ci:2.1.0 - steps: - - checkout - - run: - name: update common repo - command: git submodule update --init - - run: make prepare - - run: make - - run: make clean - - run: make style-check - - run: make release - - run: - name: build stub release drivers - command: | - (cd release/sps30-i2c - make CONFIG_I2C_TYPE=hw_i2c - make CONFIG_I2C_TYPE=sw_i2c - make clean) - - run: - name: build Linux release drivers - command: | - (cd release/sps30-i2c - make CONFIG_I2C_TYPE=hw_i2c hw_i2c_impl_src=hw_i2c/sample-implementations/linux_user_space/sensirion_hw_i2c_implementation.c - make CONFIG_I2C_TYPE=sw_i2c sw_i2c_impl_src=sw_i2c/sample-implementations/linux_user_space/sensirion_sw_i2c_implementation.c - make clean) - deploy: - docker: - - image: sensirion/embedded-ci:2.1.0 - steps: - - checkout - - run: - name: update common repo - command: git submodule update --init - - run: make release - - run: - name: Move zip files to artifact directory - command: | - mkdir -p /releases - mv release/*.zip /releases/ - - persist_to_workspace: - root: /releases - paths: . - - store-artifacts: - path: /releases - - github-release: - docker: - - image: cibuilds/github:0.13 - steps: - - attach_workspace: - at: /releases - - run: - name: "Publish Release on GitHub" - command: ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -n "Embedded-SPS ${CIRCLE_TAG}" -soft ${CIRCLE_TAG} /releases/ - -workflows: - version: 2 - build_and_deploy: - jobs: - - build: - filters: # required since `deploy` has tag filters AND requires `build` - tags: - only: /.*/ - - deploy: - requires: - - build - filters: - branches: - only: master - tags: - only: /^\d+\.\d+\.\d+$/ - - github-release: - requires: - - deploy - filters: - branches: - ignore: /.*/ - tags: - only: /^\d+\.\d+\.\d+$/ diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..4aef3ca --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,21 @@ +name: syntax, static code analyis and build check for c drivers + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + code-analysis: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: awalsh128/cache-apt-pkgs-action@v1 + with: + packages: cppcheck clang-format + version: 1.0 + - name: cppcheck static code analyis + run: cppcheck --std=c89 --language=c --error-exitcode=1 --enable=warning,style,performance,portability --suppress=unreadVariable -i embedded-common/ -i release/ . diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index f837528..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,33 +0,0 @@ -include: 'https://raw.githubusercontent.com/Sensirion/ci-config-github/master/github-status-gitlab-ci-template-v1.yml' - -stages: - - publish_build_pending - - build - - publish_build_status - -variables: - GIT_SUBMODULE_STRATEGY: recursive - GITHUB_PROJECT_NAME: embedded-sps - -publish_build_pending: - extends: .github_publish_pending - stage: publish_build_pending - -publish_success: - extends: .github_publish_success - stage: publish_build_status - -publish_failure: - extends: .github_publish_failure - stage: publish_build_status - -test: - stage: build - image: - name: registry.gitlab.sensirion.lokal/sensirion/docker/docker-rpi-testbed:1.1.0 - tags: - - mso-sw-testbed-2 - script: - - git clone -b 2.0.0 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab/MSO-SW/drivers/testbed/i2c-mux-testbed.git - - cd tests - - make test diff --git a/sps30-i2c/test_projects/Arduino/arduino_sps30_example/arduino_sps30_example.ino b/sps30-i2c/test_projects/Arduino/arduino_sps30_example/arduino_sps30_example.ino index 45172c7..e528e23 100644 --- a/sps30-i2c/test_projects/Arduino/arduino_sps30_example/arduino_sps30_example.ino +++ b/sps30-i2c/test_projects/Arduino/arduino_sps30_example/arduino_sps30_example.ino @@ -18,25 +18,25 @@ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include #include "sps30.h" - void setup() { Serial.begin(115200); while (!Serial) { - delay(100); + delay(100); } } @@ -61,7 +61,7 @@ void loop() { ret = sps30_read_measurement(&measurement); if (ret < 0) { - Serial.write("read measurement failed\n"); + Serial.write("read measurement failed\n"); } else { Serial.write("PM 2.5: "); Serial.println(measurement.mc_2p5, DEC); diff --git a/tests/sps30-test.cpp b/tests/sps30-test.cpp index 954c09d..d84468e 100644 --- a/tests/sps30-test.cpp +++ b/tests/sps30-test.cpp @@ -146,10 +146,18 @@ TEST_GROUP (SPSTestGroup) { } }; -TEST (SPSTestGroup, SPS30Test_no_cleaning) { sps30_test(0); } +TEST (SPSTestGroup, SPS30Test_no_cleaning) { + sps30_test(0); +} -TEST (SPSTestGroup, SPS30Test_daily_cleaning) { sps30_test(1); } +TEST (SPSTestGroup, SPS30Test_daily_cleaning) { + sps30_test(1); +} -TEST (SPSTestGroup, SPS30Test_weekly_cleaning) { sps30_test(7); } +TEST (SPSTestGroup, SPS30Test_weekly_cleaning) { + sps30_test(7); +} -TEST (SPSTestGroup, SPS30Test_maximum_cleaning) { sps30_test(255); } +TEST (SPSTestGroup, SPS30Test_maximum_cleaning) { + sps30_test(255); +}