Repository: at-wat/eagle2svg (language: python)

Issue:
Migrate to GitHub Actions
New Travis-CI's plan requires approval by Travis-CI staff for free OSS builds.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/hide-old-bot-comments.yml b/.github/workflows/hide-old-bot-comments.yml
new file mode 100644
index 0000000..189c27a
--- /dev/null
+++ b/.github/workflows/hide-old-bot-comments.yml
@@ -0,0 +1,13 @@
+name: hide-old-bot-comments
+on: pull_request
+
+jobs:
+  hide-old-bot-comments:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Hide old bot comments
+        uses: kamatama41/hide-pr-comments-action@v0
+        with:
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+          message_regex: "(Passed|Failed) on"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..dd8d02c
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,19 @@
+name: release
+on:
+  push:
+    tags:
+        - '*.*.*'
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Setup Python
+        uses: actions/setup-python@v2
+      - name: Deploy
+        uses: pypa/gh-action-pypi-publish@v1.4.1
+        with:
+          user: __token__
+          password: ${{ secrets.PYPI_TOKEN }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 9acd744..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-language: python
-python:
-  - 2.7
-  - 3.6
-
-install:
-  - pip install cairosvg==1.0.22 pycodestyle pyflakes gh-pr-comment
-  - ./tests/coding-style.sh
-  - python setup.py install
-
-script:
-  - ./tests/exec-test.sh
-
-deploy:
-  provider: pypi
-  user: at-wat
-  password:
-    secure: vy+oaB0f1eBHoAz1g8A28mqDIQejWFr6649ZnmZppEccJa6B0rtfPSchbL1RqrzDjfGlTFTnpHsvs228V8qv48dHCu8X30+Ahpff1EAS2APTKx+n2tc/efQATF5MFEqhhNuADPUPGybblkfyGCfw4rMDaPq0zvQuG/YP1l49CS+Ifa1QCVVeD7A/LyXbws2qe/Lt3jKwGw3UcixhMKHmIWAcQNFaPHhzFFmz0Rhdw6Xbg9iNTQjeUvAsnZ24t1zR+TDKg/9BXUDS46Dxdx6PCpTdWabP3rJQT9PVRAEDxv2qCiPXI3rFakRhmKD4Xz7r7FzTWM4MxCFHA/FgSHlQX4+6Qr2D6jdEcXgqhMmweXS4LsPWnQXXpiFovC/yiApYIvGsge/7ofUFv8bhKz9djF6kA7+Pqr7WFDt2S0poG/KQVu/VzCTLZIml1M/24BPaadFZ9sqco5L4WAs5nEg4I3YUm1ho+zsbJ6+lJK9FzUtvrZOmGdHrULm+rMVkESGsc70dMkrNHOW7v+FuWu/ttSZ7SL1sRq6b7fpylbnqPpotKvs8JJ84tv/7l3UhYWNP+IJHLZjbuKoi8ME6r9B/YoMa10sNh7NdtTR4Skxu8BJYfLOl1UPrh6o45iegXvmz/hCH5mpdTWWZY4hUtn/vnl0wfReBB3odN80OS15w0AA=
-  on:
-    tags: true
-    python: 3.6


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..89c615b
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,44 @@
+name: test
+on:
+  pull_request:
+    branches:
+      - master
+  push:
+    branches:
+      - master
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version:
+          - '3.7'
+          - '3.8'
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Setup Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Install gh-pr-comment
+        run: |
+          curl -sL https://raw.githubusercontent.com/at-wat/gh-pr-comment/master/install.sh | sh -s
+          echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - name: Lint
+        run: |
+          python -m pip install cairosvg==1.0.22 pycodestyle pyflakes
+          ./tests/coding-style.sh
+      - name: Test
+        run: |
+          python setup.py install
+          ./tests/exec-test.sh
+          sleep 5
+        env:
+          ALLOW_PUBLIC_UPLOADER: 1
+          GITHUB_API_URL_BASE: https://ghbot-api.at-wat.tokyo
+          GITHUB_TOKEN: bfac2435-4211-42ee-a1d6-0dfaf6b3b73d
diff --git a/tests/coding-style.sh b/tests/coding-style.sh
index c48c4ea..c21f9a5 100755
--- a/tests/coding-style.sh
+++ b/tests/coding-style.sh
@@ -2,7 +2,7 @@
 
 set -eu
 
-PY=`find . -type d -name build -prune -o -name "*.py" -print | tr '\n' ' '`
+PY=$(find . -type d -name build -prune -o -name "*.py" -print | tr '\n' ' ')
 echo "pyflakes targets: ${PY}"
 
 LOG=/tmp/coding-style.log
@@ -15,8 +15,8 @@ do
   pyflakes ${py} >> ${LOG} || fail=1; true
 done
 
-FAILED="Failed on python ${TRAVIS_PYTHON_VERSION}"
-PASSED="Passed on python ${TRAVIS_PYTHON_VERSION}"
+FAILED="Failed on $(python --version)"
+PASSED="Passed on $(python --version)"
 
 if [ $fail -eq 1 ]
 then
@@ -24,8 +24,9 @@ then
   gh-pr-comment "${FAILED}" \
     "style check failed.
 \`\`\`
-`cat ${LOG}`
+$(cat ${LOG})
 \`\`\`"
+  sleep 5
   false
 fi
 echo 'passed'
diff --git a/tests/exec-test.sh b/tests/exec-test.sh
index b448f60..14e0eb6 100755
--- a/tests/exec-test.sh
+++ b/tests/exec-test.sh
@@ -2,8 +2,8 @@
 
 set -eu
 
-FAILED="Failed on python ${TRAVIS_PYTHON_VERSION}"
-PASSED="Passed on python ${TRAVIS_PYTHON_VERSION}"
+FAILED="Failed on python $(python --version)"
+PASSED="Passed on python $(python --version)"
 
 eagle2svg ./tests/data/test.sch > test.sch.svg \
   || (gh-pr-comment "${FAILED}" '`eagle2svg ./tests/data/test.sch` failed.'; false)
@@ -19,15 +19,15 @@ cairosvg -f png -d 450 -o test-top.brd.png test-top.brd.svg \
 cairosvg -f png -d 450 -o test-bottom.brd.png test-bottom.brd.svg \
   || (gh-pr-comment "${FAILED}" '`cairosvg -f png test.sch.svg` failed.'; false)
 
-if [ "${TRAVIS_PULL_REQUEST}" != "false" ];
+if [ "${GITHUB_EVENT_NAME}" = "pull_request" ];
 then
-  image1=`gh-pr-upload test.sch.png`
-  image2=`gh-pr-upload test-top.brd.png`
-  image3=`gh-pr-upload test-bottom.brd.png`
+  image1=$(gh-pr-upload test.sch.png)
+  image2=$(gh-pr-upload test-top.brd.png)
+  image3=$(gh-pr-upload test-bottom.brd.png)
 
   gh-pr-comment "${PASSED}" "all tests passed
 \`\`\`
-`ls -lh *.svg *.png`
+$(ls -lh *.svg *.png)
 \`\`\`
 
 ![test.sch.png](${image1})