Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Move from travis to Github Actions #344

Merged
merged 9 commits into from
Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@ jobs:

- name: Run spellchecker
run: ./check-spelling.sh
if: ${{ success() }}

- name: Install antidote binaries
run: curl -Lo antidote.tar.gz https://github.com/nre-learning/antidote-core/releases/download/v0.6.2/antidote-linux-amd64.tar.gz && tar xvzf antidote.tar.gz
if: ${{ success() }}

- name: Run antidote validation
run: ./antidote validate .
if: ${{ success() }}

- name: Check changelog
run: ./check-changelog.sh
if: ${{ success() }}

- name: Request preview
run: ./request-preview.sh
if: ${{ success() }}

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## In development

- Migrating from travis to github actions [#344](https://github.com/nre-learning/nrelabs-curriculum/pull/344)
- Converged motd banners in crpd, added helper tip for 'cli' command [#343](https://github.com/nre-learning/nrelabs-curriculum/pull/343)
- Misc curriculum updates for Antidote 0.7 compatibility [#341](https://github.com/nre-learning/nrelabs-curriculum/pull/341)
- Refurbish JSNAPy lesson and move to cRPD [#338](https://github.com/nre-learning/nrelabs-curriculum/pull/338)
Expand Down
13 changes: 10 additions & 3 deletions check-changelog.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

git fetch origin master

echo $(git branch)
Expand All @@ -9,17 +10,23 @@ echo $(cat .git/HEAD)
# exit 0
# fi

if [ "$TRAVIS_PULL_REQUEST" != "false" ];
echo "ENV TO FOLLOW"
echo $(env)


if [ "$GITHUB_EVENT_NAME" != "pull_request" ];
then
echo "This is PR build, skipping the changelog check"
echo "This is not a pull request, skipping the changelog check"
exit 0
fi

echo "Detecting changes..."
echo $(git diff --name-only $(git rev-parse FETCH_HEAD))

if echo $(git diff --name-only $(git rev-parse FETCH_HEAD)) | grep -w CHANGELOG.md > /dev/null; then
echo "Thanks for making a CHANGELOG update!"
exit 0
else
echo "No CHANGELOG update found. Please provide update to CHANGELOG for this change."
exit 1
fi
fi
29 changes: 10 additions & 19 deletions request-preview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ set -e +o pipefail

url="https://preview.nrelabs.io/webhook"

# https://docs.travis-ci.com/user/environment-variables/
echo "TRAVIS_PULL_REQUEST_SHA - $TRAVIS_PULL_REQUEST_SHA"
echo "TRAVIS_COMMIT - $TRAVIS_COMMIT"
echo "TRAVIS_JOB_NUMBER - $TRAVIS_JOB_NUMBER"
echo "TRAVIS_PULL_REQUEST - $TRAVIS_PULL_REQUEST"
echo "TRAVIS_JOB_ID - $TRAVIS_JOB_ID"
echo "TRAVIS_REPO_SLUG - $TRAVIS_REPO_SLUG"
echo "env - $env"
echo "TRAVIS_OS_NAME - $TRAVIS_OS_NAME"
echo "TRAVIS_TAG - $TRAVIS_TAG"
echo "TRAVIS_BRANCH - $TRAVIS_BRANCH"
echo "TRAVIS_PULL_REQUEST_BRANCH - $TRAVIS_PULL_REQUEST_BRANCH"

if [ "$TRAVIS_PULL_REQUEST" == "false" ];
echo "ENV TO FOLLOW"
echo $(env)

PR_ID=$(echo $GITHUB_REF | sed "s/refs\/pull\/\(.*\)\/merge/\1/")

if [ "$GITHUB_EVENT_NAME" != "pull_request" ];
then
echo "Not a PR build, skipping preview"
exit 0
Expand All @@ -27,13 +19,12 @@ echo "Requesting preview...."

curl $url --header "Content-Type: application/json" \
--data "{
\"branch\":\"$TRAVIS_PULL_REQUEST_BRANCH\",
\"pullRequest\":\"$TRAVIS_PULL_REQUEST\",
\"repoSlug\":\"$TRAVIS_PULL_REQUEST_SLUG\",
\"prSha\":\"$TRAVIS_PULL_REQUEST_SHA\"
\"branch\":\"$GITHUB_HEAD_REF\",
\"pullRequest\":\"$PR_ID\",
\"repoSlug\":\"$GITHUB_REPOSITORY\",
\"prSha\":\"$GITHUB_SHA\"
}"


echo "DONE!"

exit 0