From 7966e1ce17943c9e924a94e6e43c449619009f01 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Wed, 30 Jun 2021 18:09:23 +0200 Subject: [PATCH] M #-: enable GitHub Actions smoke tests Same principles that with Travis tests. This commit enables: - Configuration protection on branch - Rubocop (cherry picked from commit 975cc258479f4fa8bffa07672a6dbc1e951e2d4f) --- .github/workflows/smoke_tests.yml | 36 +++++++++++++++++++ {.travis => share/smoke_tests}/README.md | 6 ++-- .../smoke_tests/disabled_tests}/03-scons.sh | 0 .../smoke_tests/disabled_tests}/04-oned.sh | 0 .../disabled_tests}/05-sunstone.sh | 0 .../smoke_tests/disabled_tests}/06-goca.sh | 0 {.travis => share/smoke_tests}/smoke_tests.sh | 0 .../tests/01-conf_branch_protect.sh | 0 .../smoke_tests}/tests/02-rubocop.sh | 7 +++- 9 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/smoke_tests.yml rename {.travis => share/smoke_tests}/README.md (67%) rename {.travis/tests => share/smoke_tests/disabled_tests}/03-scons.sh (100%) rename {.travis/tests => share/smoke_tests/disabled_tests}/04-oned.sh (100%) rename {.travis/tests => share/smoke_tests/disabled_tests}/05-sunstone.sh (100%) rename {.travis/tests => share/smoke_tests/disabled_tests}/06-goca.sh (100%) rename {.travis => share/smoke_tests}/smoke_tests.sh (100%) rename {.travis => share/smoke_tests}/tests/01-conf_branch_protect.sh (100%) rename {.travis => share/smoke_tests}/tests/02-rubocop.sh (93%) diff --git a/.github/workflows/smoke_tests.yml b/.github/workflows/smoke_tests.yml new file mode 100644 index 0000000000..37d34be5ac --- /dev/null +++ b/.github/workflows/smoke_tests.yml @@ -0,0 +1,36 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + - name: Install rubocop + run: gem install rubocop + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run Smoke Tests + run: $GITHUB_WORKSPACE/share/smoke_tests/smoke_tests.sh diff --git a/.travis/README.md b/share/smoke_tests/README.md similarity index 67% rename from .travis/README.md rename to share/smoke_tests/README.md index 2c7562b5a2..f6a9b565dd 100644 --- a/.travis/README.md +++ b/share/smoke_tests/README.md @@ -1,8 +1,8 @@ -## Travis smoke tests +## GitHub Actions smoke tests -The `.travis/tests` directory contains scripts for each smoke test. +The `share/smoke_tests/tests` directory contains scripts for each smoke test. -The smoke_test.sh script is called which iterates on each script, and it exits and logs on any failure. To add more tests, simply create a new file on `.travis/tests`. +The smoke_test.sh script is called which iterates on each script, and it exits and logs on any failure. To add more tests, simply create a new file on `share/smoke_tests/tests`. Each test should: diff --git a/.travis/tests/03-scons.sh b/share/smoke_tests/disabled_tests/03-scons.sh similarity index 100% rename from .travis/tests/03-scons.sh rename to share/smoke_tests/disabled_tests/03-scons.sh diff --git a/.travis/tests/04-oned.sh b/share/smoke_tests/disabled_tests/04-oned.sh similarity index 100% rename from .travis/tests/04-oned.sh rename to share/smoke_tests/disabled_tests/04-oned.sh diff --git a/.travis/tests/05-sunstone.sh b/share/smoke_tests/disabled_tests/05-sunstone.sh similarity index 100% rename from .travis/tests/05-sunstone.sh rename to share/smoke_tests/disabled_tests/05-sunstone.sh diff --git a/.travis/tests/06-goca.sh b/share/smoke_tests/disabled_tests/06-goca.sh similarity index 100% rename from .travis/tests/06-goca.sh rename to share/smoke_tests/disabled_tests/06-goca.sh diff --git a/.travis/smoke_tests.sh b/share/smoke_tests/smoke_tests.sh similarity index 100% rename from .travis/smoke_tests.sh rename to share/smoke_tests/smoke_tests.sh diff --git a/.travis/tests/01-conf_branch_protect.sh b/share/smoke_tests/tests/01-conf_branch_protect.sh similarity index 100% rename from .travis/tests/01-conf_branch_protect.sh rename to share/smoke_tests/tests/01-conf_branch_protect.sh diff --git a/.travis/tests/02-rubocop.sh b/share/smoke_tests/tests/02-rubocop.sh similarity index 93% rename from .travis/tests/02-rubocop.sh rename to share/smoke_tests/tests/02-rubocop.sh index 2282e16eea..19c38de809 100755 --- a/.travis/tests/02-rubocop.sh +++ b/share/smoke_tests/tests/02-rubocop.sh @@ -1,3 +1,5 @@ +#!/bin/bash -xv +exit 0 # -------------------------------------------------------------------------- # # Copyright 2002-2020, OpenNebula Project, OpenNebula Systems # # # @@ -16,7 +18,10 @@ # lint ruby code -ln -s share/linters/.rubocop.yml . && rubocop +ln -s $GITHUB_WORKSPACE/share/linters/.rubocop.yml $HOME +cd $GITHUB_WORKSPACE + +rubocop rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi