Skip to content

Commit

Permalink
wip: Refactor CI to use GitHub actions and generic bash scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Apr 22, 2024
1 parent bfe6966 commit 6d60be5
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,22 @@ jobs:
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
run: bash ./scripts/run_tests.sh -n ${{ matrix.node }} -m ${{ matrix.mongo }}

build_docs:
name: Build doc
if: ${{ contains(github.event.head_commit.message, 'build doc') }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: true
- name: Init runner
run: bash ./scripts/init_runner.sh ${{ github.job }}
- name: Setup workspace
env:
GITHUB_DEVELOPMENT_TOKEN: ${{ secrets.GH_DEVELOPMENT_TOKEN }}
run: bash ./scripts/setup_workspace.sh
- name: Build docs
env:
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
run: bash ./scripts/build_docs.sh -p -r ${{ github.job }}
37 changes: 37 additions & 0 deletions scripts/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail
# set -x

THIS_FILE=$(readlink -f "${BASH_SOURCE[0]}")
THIS_DIR=$(dirname "$THIS_FILE")
ROOT_DIR=$(dirname "$THIS_DIR")
WORKSPACE_DIR="$(dirname "$ROOT_DIR")"

. "$THIS_DIR/kash/kash.sh"

## Parse options
##

PUBLISH=false
CI_STEP_NAME="Build docs"
while getopts "pr:" OPT; do
case $OPT in
p) # publish doc
PUBLISH=true
;;
r) # report outcome to slack
CI_STEP_NAME=$OPTARG
load_env_files "$WORKSPACE_DIR/development/common/SLACK_WEBHOOK_JOBS.enc.env"
trap 'slack_ci_report "$ROOT_DIR" "$CI_STEP_NAME" "$?" "$SLACK_WEBHOOK_JOBS"' EXIT
;;
*)
;;
esac
done


## Build docs
##

build_docs "$ROOT_DIR" "kalisio/kdk" "$PUBLISH"

2 changes: 1 addition & 1 deletion scripts/init_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ THIS_DIR=$(dirname "$THIS_FILE")
### Github Actions

init_github_run_tests() {
install_reqs age sops nvm node16 cc_test_reporter
install_reqs age sops nvm node16 mongo4 cc_test_reporter
}

init_github_additional_tests() {
Expand Down

0 comments on commit 6d60be5

Please sign in to comment.