Skip to content

Commit

Permalink
ci: mplementing new workflow using kash repository
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-greffe committed Mar 7, 2024
1 parent 997f19b commit 2651c12
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 36 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/main.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run tests
on:
push:
branches:
- gha
jobs:
run_tests:
strategy:
fail-fast: false
matrix:
node: [ 16 ]
mongo: [ 4 ]
# node: [ 16, 18, 20 ]
# mongo: [ 4, 5, 6 ]
name: Tests / Node ${{ matrix.node }} / Mongo ${{ matrix.mongo }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: true
# - name: Cache requirements
# uses: actions/cache@v4
# with:
# key: requirements
# path: ${{ runner.temp }}/dl
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# - uses: actions/cache@v4
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Init runner
run: bash ./scripts/init_runner.sh ${{ github.job }}
- name: Setup workspace
env:
GITHUB_DEVELOPMENT_PAT: ${{ secrets.GH_DEVELOPMENT_PAT }}
run: bash ./scripts/setup_workspace.sh -k klifull -n ${{ matrix.node }}
- name: Run tests
env:
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
run: bash ./scripts/run_tests.sh -n ${{ matrix.node }} -m ${{ matrix.mongo }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "scripts/kash"]
path = scripts/kash
url = https://github.com/kalisio/kash.git
1 change: 1 addition & 0 deletions scripts/kash
Submodule kash added at 13bf49
55 changes: 55 additions & 0 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/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")

. "$THIS_DIR/kash/kash.sh"

## Parse options
##

NODE_VER=16
MONGO_VER=4
while getopts "m:n:" option; do
case $option in
m) # defines mongo version
MONGO_VER=$OPTARG;;
n) # defines node version
NODE_VER=$OPTARG;;
*)
;;
esac
done

## Init workspace
##

WORKSPACE_DIR="$(dirname "$ROOT_DIR")"
init_app_infos "$ROOT_DIR" "$WORKSPACE_DIR/development/workspaces/apps"

APP=$(get_app_name)
VERSION=$(get_app_version)
FLAVOR=$(get_app_flavor)

echo "About to run tests for ${APP} v${VERSION}-($FLAVOR) ..."

. "$WORKSPACE_DIR/development/workspaces/apps/apps.sh" kapp

## Start mongo
##

begin_group "Starting mongo $MONGO_VER ..."

use_mongo "$MONGO_VER"
k-mongo

end_group "Starting mongo $MONGO_VER ..."

## Run tests
##

use_node "$NODE_VER"
yarn test

0 comments on commit 2651c12

Please sign in to comment.