From 6b7f0ec90abae6d4a3f1f6aded17304f17f72e7d Mon Sep 17 00:00:00 2001 From: Kushagra Dwivedi <100153737+pearguacamole@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:15:40 +0530 Subject: [PATCH] Feat: add GitHub actions (#8) * feat: add github workflow to run test.sh after every commit * add lint for plugin and shell in workflow * remove shell setup step - redundent * fix: ensure correct exit codes in .ci/ scripts --------- Co-authored-by: Navin Chandra <98466550+navin772@users.noreply.github.com> --- .ci/lint-plugin.sh | 5 ++++- .ci/lint-shell.sh | 4 ++++ .ci/test.sh | 6 +++++- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.ci/lint-plugin.sh b/.ci/lint-plugin.sh index c63b975..13c13f3 100755 --- a/.ci/lint-plugin.sh +++ b/.ci/lint-plugin.sh @@ -5,10 +5,13 @@ REPO_DIR=$(git rev-parse --show-toplevel) pushd "${REPO_DIR}" >/dev/null docker run \ - -it \ --rm \ -v "$(pwd):/plugin" \ buildkite/plugin-linter \ --id lambdatest/lambdatest +EXIT_CODE=$? + popd >/dev/null + +exit $EXIT_CODE diff --git a/.ci/lint-shell.sh b/.ci/lint-shell.sh index 56e8dbd..a8473aa 100755 --- a/.ci/lint-shell.sh +++ b/.ci/lint-shell.sh @@ -11,4 +11,8 @@ docker run \ --rm \ koalaman/shellcheck hooks/* +EXIT_CODE=$? + popd >/dev/null + +exit $EXIT_CODE diff --git a/.ci/test.sh b/.ci/test.sh index ff1754e..ed16940 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -4,6 +4,10 @@ REPO_DIR=$(git rev-parse --show-toplevel) pushd "${REPO_DIR}" >/dev/null -docker-compose run --rm tests +docker compose run --rm tests + +EXIT_CODE=$? popd >/dev/null + +exit $EXIT_CODE diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d8fd8d5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI Pipeline +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + lint-plugin: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Lint for plugins + run: .ci/lint-plugin.sh + + lint-shell: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Lint for shell + run: .ci/lint-shell.sh + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run test.sh + run: .ci/test.sh +