Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76181a7

Browse files
authored
Merge pull request #199 from pzelnip/githubactions
Lets try github actions instead of the garbage that is Travis
2 parents 95eac33 + 867fce1 commit 76181a7

File tree

4 files changed

+59
-26
lines changed

4 files changed

+59
-26
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build the Site
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the mainline branch
5+
on:
6+
pull_request:
7+
branches: [ mainline ]
8+
9+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
10+
jobs:
11+
# This workflow contains a single job called "build"
12+
build:
13+
# The type of runner that the job will run on
14+
runs-on: ubuntu-latest
15+
# container: pzelnip/codependentcodrbase:latest
16+
env:
17+
DOCKER_USERNAME: pzelnip
18+
19+
steps:
20+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
21+
- uses: actions/checkout@v2
22+
23+
- name: Print env vars
24+
run: echo "$GITHUB_REF -- $GITHUB_EVENT_NAME -- $GITHUB_SHA -- $GITHUB_HEAD_REF -- $GITHUB_BASE_REF"
25+
26+
# Runs a single command using the runners shell
27+
- name: Run tests
28+
shell: 'script -q -e -c "bash {0}"'
29+
run: make GH_TOKEN=foobar TRAVIS_BRANCH=$GITHUB_HEAD_REF test
30+
env:
31+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ services:
66
- docker
77

88
script:
9+
# use travis to only build if merged to mainline, GH actions now cover PRs
910
- if [ "$TRAVIS_BRANCH" = "mainline" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
10-
make deploy; else make test; fi
11+
make deploy; fi
1112

1213
notifications:
1314
email: false

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ bandit:
8686
docker run -it --rm $(SITE_NAME):latest bandit . -r
8787

8888
blackenit: dockerbuild
89+
echo "-----${GH_TOKEN}------${TRAVIS_BRANCH}-----"
8990
./black_out.sh ${GH_TOKEN} ${TRAVIS_BRANCH}
9091

9192
test: blackenit lint_the_things bandit

black_out.sh

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ fi
1111
echo "Blackening code for $2...."
1212

1313
# Run black over the code
14-
docker run -it --rm -v `pwd`:/build codependentcodr:latest black .
15-
16-
# if no changes, then exit cleanly
17-
if [ -z "$(git status --porcelain)" ]; then
18-
exit 0
19-
else
20-
# else lets commit the blackening...
21-
22-
echo "Dirty directory"
23-
24-
# Have to check out the branch because Travis is dumb, on
25-
# a branch build it checks out a detached HEAD instead of
26-
# the branch itself
27-
echo "Checking out $2"
28-
git checkout $2
29-
30-
# commit the changes
31-
git commit -am "BLACK-123 Automated Black out"
32-
33-
# push back to Github & abort the build since a new build will
34-
# get triggered by the push
35-
git push https://$1@github.com/pzelnip/www.codependentcodr.com $2
36-
echo "Blackened changes, aborting build"
37-
exit 1
38-
fi
14+
docker run -it --rm -v `pwd`:/build codependentcodr:latest black --check .
15+
16+
# # if no changes, then exit cleanly
17+
# if [ -z "$(git status --porcelain)" ]; then
18+
# exit 0
19+
# else
20+
# # else lets commit the blackening...
21+
22+
# echo "Dirty directory"
23+
24+
# # Have to check out the branch because Travis is dumb, on
25+
# # a branch build it checks out a detached HEAD instead of
26+
# # the branch itself
27+
# # echo "Checking out $2"
28+
# # git checkout $2
29+
30+
# # # commit the changes
31+
# # git commit -am "BLACK-123 Automated Black out"
32+
33+
# # push back to Github & abort the build since a new build will
34+
# # get triggered by the push
35+
# # git push https://[email protected]/pzelnip/www.codependentcodr.com $2
36+
# echo "Blackened changes, aborting build"
37+
# exit 1
38+
# fi

0 commit comments

Comments
 (0)