Skip to content

Commit

Permalink
Github actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yehiyam authored Nov 30, 2020
1 parent ebde420 commit 57b600b
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 85 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/automerge.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This is a basic workflow to help you get started with Actions

name: CI-MAIN

# 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]
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"
test_and_build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Opens tcp port 6379 on the host and service container
- 6379:6379
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- run: git fetch --prune --unshallow
- uses: actions/setup-node@v1
with:
node-version: 14.x
- run: ./scripts/beforeInstall.sh
- run: |
npm ci
echo "$PWD/node_modules/.bin" >> $GITHUB_PATH
- name: bootstrap
run: |
export CHANGED=$(lerna changed --includeMergedTags)
echo ${CHANGED}
# export CHANGED=${CHANGED:-$(lerna list)}
echo ${CHANGED} | xargs -n 1 -d ' ' -I {} lerna exec npm ci --scope {}
echo CHANGED=$CHANGED >> $GITHUB_ENV
- name: build and test
run: |
echo $CHANGED
if [ -z $CHANGED ];
then
echo nothing changed
else
scripts/runTestAndBuild.sh
fi
- name: trigger
if: env.CHANGED
id: trigger
uses: octokit/[email protected]
with:
route: POST /repos/kube-HPC/release-manager/dispatches
event_type: trigger
env:
GITHUB_TOKEN: '${{ secrets.GH_TOKEN }}'
28 changes: 24 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
# 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:
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
services:
Expand All @@ -32,10 +32,30 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- run: scripts/beforeInstall.sh
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm ci
- run: NODE_ENV=test npm run-script test-travis
- run: ./scripts/beforeInstall.sh
- run: |
npm ci
echo "$PWD/node_modules/.bin" >> $GITHUB_PATH
- name: bootstrap
run: |
export CHANGED=$(lerna changed --includeMergedTags)
echo ${CHANGED}
# export CHANGED=${CHANGED:-$(lerna list)}
# echo ${CHANGED}
echo ${CHANGED} | xargs -n 1 -d ' ' -I {} lerna exec npm ci --scope {}
echo CHANGED=$CHANGED >> $GITHUB_ENV
- name: test
run: |
echo $CHANGED
if [ -z $CHANGED ];
then
echo nothing changed
else
./scripts/test.sh
fi
1 change: 0 additions & 1 deletion core/api-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ See [hkube.io](http://hkube.io/)
## License

[MIT](LICENSE)

2 changes: 1 addition & 1 deletion core/pipeline-driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ First the task runner consumes a job, then it goes as follows:
8. then update the progress of the task in etcd.
9. decide if to run the next task in the pipeline.
10. if one node failed, the entire pipeline will failed.
11. unless this node is part of a batch and the batch tolerance lower the total failed.
11. unless this node is part of a batch and the batch tolerance lower the total failed.
37 changes: 12 additions & 25 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
#!/bin/bash
set -x
if ([ "$TRAVIS_BRANCH" == "master" ] || [ ! -z "$TRAVIS_TAG" ]) && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo ${DOCKER_HUB_PASS} | docker login --username yehiyam --password-stdin
echo ${CHANGED}
for REPO in ${CHANGED}
do
echo ${REPO} changed. Running build
export PRIVATE_REGISTRY=docker.io/hkube
lerna run --scope $REPO --stream build
echo lerna run --scope $REPO build exited with code $?
echo "build done for ${REPO}"
done
else
echo "version skiped!"
echo "building to test docker"
echo ${CHANGED}
for REPO in ${CHANGED}
do
echo ${REPO} changed. Running build
unset PRIVATE_REGISTRY
lerna run --scope $REPO --stream build
echo lerna run --scope $REPO build exited with code $?
echo "build done for ${REPO}"
done
fi
set -xo pipefail
echo ${DOCKER_HUB_PASS} | docker login --username yehiyam --password-stdin
echo ${CHANGED}
for REPO in ${CHANGED}
do
echo ${REPO} changed. Running build
export PRIVATE_REGISTRY=docker.io/hkube
lerna run --scope $REPO --stream build
echo lerna run --scope $REPO build exited with code $?
echo "build done for ${REPO}"
done

echo "all builds done."
28 changes: 9 additions & 19 deletions scripts/createVersion.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
#!/bin/bash
set -ev
if ([ "$TRAVIS_BRANCH" == "master" ] || [ ! -z "$TRAVIS_TAG" ]) && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
git remote set-url --push origin "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git"
git remote -v
git status
git checkout -f -b version-branch
MESSAGE="$(git log -1 --pretty=%B) .... bump version [skip ci]"
lerna version patch --no-push --yes --includeMergedTags --no-git-tag-version --no-commit-hooks -m "${MESSAGE}"
lerna exec "npm install -s --ignore-scripts --package-lock-only --no-audit"
git add core/*/package-lock.json
git add core/*/package.json
HUSKY_SKIP_HOOKS=1 git commit -m "${MESSAGE}" || true
HUSKY_SKIP_HOOKS=1 npm version patch --git-tag-version --commit-hooks=false -m "${MESSAGE}"
git push origin version-branch:master --follow-tags
else
echo "version skiped!"
fi
set -evo pipefail
MESSAGE="$(git log -1 --pretty=%B) .... bump version [skip ci]"
lerna version patch --no-push --yes --includeMergedTags --no-git-tag-version --no-commit-hooks -m "${MESSAGE}"
lerna exec "npm install -s --ignore-scripts --package-lock-only --no-audit"
git add core/*/package-lock.json
git add core/*/package.json
HUSKY_SKIP_HOOKS=1 git commit -m "${MESSAGE}" || true
HUSKY_SKIP_HOOKS=1 npm version patch --git-tag-version --commit-hooks=false -m "${MESSAGE}"
git push --follow-tags
5 changes: 1 addition & 4 deletions scripts/runTestAndBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ echo running ./scripts/createVersion.sh
echo ./scripts/createVersion.sh exited with code $?
echo running ./scripts/build.sh
./scripts/build.sh
echo ./scripts/build.sh exited with code $?
echo running ./scripts/trigger.js
./scripts/trigger.js
echo ./scripts/trigger.js exited with code $?

0 comments on commit 57b600b

Please sign in to comment.