-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add workflow file for github actions (#379)
* add workflow file for github actions * removed travis yml * sepereated lint job and go tests job * changes in the secrets variable name * removed comments * change in secret name * changes * manual trigger added * only tag builds will deploy to gh-pages * changes Co-authored-by: kumaa43 <[email protected]>
- Loading branch information
1 parent
69d9a02
commit 70b10a7
Showing
4 changed files
with
217 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
name: GitHub Actions for pega helm chart | ||
|
||
env: | ||
HELM_URL: https://get.helm.sh | ||
HELM_TGZ: helm-v3.2.4-linux-amd64.tar.gz | ||
YAMLLINT_VERSION: 1.15.0 | ||
GO_VERSION: 1.13.1 | ||
|
||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
branches-ignore: | ||
- gh-pages | ||
pull_request: | ||
branches: [ master ] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
run-lint-job: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install yamllint | ||
run: | | ||
sudo pip install yamllint=="${{ env.YAMLLINT_VERSION }}" | ||
- name: run yamllint | ||
run: | | ||
yamllint -c .yamllint.yml -s $(find . -type f -name "Chart.yaml") | ||
yamllint -c .yamllint.yml -s $(find . -type f -name "values*.yaml") | ||
run-remark-job: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: lts/* | ||
|
||
- name: Install npm dependencies | ||
run: | | ||
npm install -g --save remark-cli to-vfile remark-preset-lint-recommended remark-validate-links remark-lint-no-dead-urls remark-message-control remark-preset-lint-markdown-style-guide remark-lint | ||
- name: run remark | ||
run: | | ||
remark -i .remark_ignore -f -u validate-links . | ||
run-go-tests-job: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install GO | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- run: export PATH=$PATH:/usr/local/go/bin | ||
|
||
- name: Install Helm | ||
run: | | ||
sudo rm /usr/local/bin/helm | ||
wget -q ${{ env.HELM_URL }}/${{ env.HELM_TGZ }} | ||
tar xzf ${{ env.HELM_TGZ }} | ||
mv linux-amd64/helm /usr/local/bin/helm | ||
- run: helm version | ||
|
||
- name: Now load the helm dependencies | ||
run: | | ||
make dependencies | ||
- name: Prepare for GO helm unit tests | ||
run: | | ||
mkdir $GITHUB_WORKSPACE/terratest/bin | ||
export GOPATH=$GITHUB_WORKSPACE/terratest | ||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
export PATH=$PATH:$GITHUB_WORKSPACE/terratest/bin | ||
cd terratest/src/test | ||
dep ensure | ||
- name: run go tests on pega | ||
run: | | ||
export GOPATH=$GITHUB_WORKSPACE/terratest | ||
export PATH=$PATH:$GITHUB_WORKSPACE/terratest/bin | ||
cd terratest/src/test | ||
go test test/pega | grep "FAIL" -A 8 || true ; test ${PIPESTATUS[0]} -eq 0 | ||
- name: run go tests on addons | ||
run: | | ||
export GOPATH=$GITHUB_WORKSPACE/terratest | ||
export PATH=$PATH:$GITHUB_WORKSPACE/terratest/bin | ||
cd terratest/src/test | ||
go test test/addons | grep "FAIL" -A 8 || true ; test ${PIPESTATUS[0]} -eq 0 | ||
- name: run go tests on backing services | ||
run: | | ||
export GOPATH=$GITHUB_WORKSPACE/terratest | ||
export PATH=$PATH:$GITHUB_WORKSPACE/terratest/bin | ||
cd terratest/src/test | ||
go test test/backingservices | grep "FAIL" -A 8 || true ; test ${PIPESTATUS[0]} -eq 0 | ||
run-deploy-job: | ||
runs-on: ubuntu-18.04 | ||
needs: [run-lint-job, run-remark-job, run-go-tests-job] | ||
if: ( github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') ) && success() | ||
steps: | ||
- name: Install Helm | ||
run: | | ||
wget -q ${{ env.HELM_URL }}/${{ env.HELM_TGZ }} | ||
tar xzf ${{ env.HELM_TGZ }} | ||
ls -l | ||
mv linux-amd64/helm /usr/local/bin/helm | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Now load the helm dependencies | ||
run: | | ||
make dependencies | ||
- name: before deploy step 1 | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
chmod 777 before_deploy.sh | ||
./before_deploy.sh | ||
- name: before deploy step 2 | ||
run: | | ||
make examples | ||
- name: deploy on github releases | ||
uses: marvinpinto/action-automatic-releases@latest | ||
with: | ||
prerelease: false | ||
files: | | ||
pega-kubernetes-example.tar.gz | ||
pega-openshift-example.tar.gz | ||
pega-azure-aks-example.tar.gz | ||
pega-aws-eks-example.tar.gz | ||
pega-google-gke-example.tar.gz | ||
pega-pivotal-pks-example.tar.gz | ||
repo_token: ${{ secrets.GH_ACTIONS_SECRET }} | ||
|
||
- name: deploy on github pages | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
chmod 777 update_gh_pages.sh | ||
./update_gh_pages.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_SECRET }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "${GITHUB_REF}" | ||
echo "${GITHUB_REPOSITORY}" | ||
echo "${GITHUB_ACTOR}" | ||
|
||
repo_uri="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | ||
remote_name="origin" | ||
main_branch="master" | ||
target_branch="gh-pages" | ||
tmp_build_dir="/tmp/build_dir" | ||
|
||
cd "$GITHUB_WORKSPACE" | ||
|
||
git config --global user.name "$GITHUB_ACTOR" | ||
git config --global user.email "${GITHUB_ACTOR}@bots.github.com" | ||
|
||
echo "Creating a temporary directory to build" | ||
mkdir -p "$tmp_build_dir" | ||
|
||
|
||
echo "clone a single branch gh-pages" | ||
git clone --quiet --branch="$target_branch" --depth=1 "$repo_uri" "$tmp_build_dir" > /dev/null | ||
|
||
cd "$tmp_build_dir" | ||
|
||
echo "Copying the files to the temporary build directory" | ||
rsync -rl --exclude .git --delete "$GITHUB_WORKSPACE/" . | ||
|
||
git restore linux-amd64/ | ||
echo $(pwd) | ||
ls | ||
git branch | ||
|
||
echo "preparing to commit to gh-pages" | ||
git add -A | ||
git commit -qm "Deploy ${GITHUB_REPOSITORY} to ${GITHUB_REPOSITORY}:${target_branch}" | ||
git show --stat-count=10 HEAD | ||
|
||
echo "Pushing to gh-pages" | ||
git push -q "$remote_name" "$target_branch" > /dev/null | ||
|
||
git status | ||
|
||
echo "Pushing to gh-pages complete" |