Migrate CI from travis ci to github actions (#1355)

Ref #1352
This commit is contained in:
namusyaka 2020-11-16 12:47:55 +09:00 committed by GitHub
parent 8fcbc60969
commit 6baca72c4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 67 deletions

47
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Kompose CI
on: push
env:
# Avoid noisy outputs like "tput: No value for $TERM and no -T specified"
TERM: dumb
jobs:
test:
name: Test with ${{ matrix.go }} and CROSS_COMPILE=${{ matrix.cross_compile }}
runs-on: ubuntu-18.04
strategy:
matrix:
go: [1.13, 1.14]
cross_compile: [true, false]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Install dependencies
run: go get golang.org/x/lint/golint
- name: Build a binary
run: make bin
- name: Run tests
run: make test
- name: Perform cross compile
if: ${{ matrix.cross_compile }}
run: make cross
docs:
name: Build docs and Coveralls integration
runs-on: ubuntu-18.04
needs: test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Install dependencies
run: make test-dep
- name: Collect all .coverprofile files and save it to one file gover.coverprofile
run: gover
- name: Send coverage
run: goveralls -coverprofile=gover.coverprofile -service=github
env:
# As per https://github.com/mattn/goveralls#github-actions
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./script/sync-docs.sh
if: ${{ github.ref == 'refs/heads/master' }}

View File

@ -1,52 +0,0 @@
# we need trusty because test-cmd depends on jq version >= 1.5
dist : trusty
sudo: required
language: go
# make this also work for forks
go_import_path: github.com/kubernetes/kompose
matrix:
include:
- go: "1.13"
env:
# Only build docs once
- BUILD_DOCS=yes
# Test cross-compile as well
- CROSS_COMPILE=yes
- go: "1.14"
install:
- true
# This is required because sometimes Travis ends up in a detached HEAD state after git clone
- script/test/cmd/fix_detached_head.sh
script:
- make bin
- make test
# Only cross-compile once
- if [ "$CROSS_COMPILE" == "yes" ]; then make cross; fi
after_success:
# gover collects all .coverprofile files and saves it to one file gover.coverprofile
- gover
- goveralls -coverprofile=gover.coverprofile -service=travis-ci
# sync the docs only if everything else was successful
- ./script/sync-docs.sh
before_deploy:
- make cross
- ./script/generate-bintray-json.sh
deploy:
provider: bintray
repo: kompose/kompose
file: ./.bintray.json
user:
secure: "dAbxiVGW5eGlnSU5CgYkNnCncWembkqWKne1SG7gS0vIUr8Qt61VwTeJ8vC14QzVmLoO1iJB+qiBcdASrGtzma95aaIAuoNFapc3Oubou6UDRQ7lA+mWBflVKGY4Oo7gcSSEtFaxhJApdkfK+cuEih2ekUS2UxL3A2kVkDNzdVreFuRI6Lr8RjNpqDjRSxjjDTBPFsjSwvq4gWyfAwoYvIyg67OCpz09BxQI+wcInuZgXd2uecq6QucSE7fTsZeqEHIjS3NormlWkKhZrQJrrAHVcr0p3EqVF0lfV1LjlQ7MkjcEsF4jxm+ggOGPs3UbrqDvW5XJBlb7Fi+0bdU+k2IcF5vbl17TbhmVHrdCZC0hLrmv+LF3E/Hx3Evv3lNTIS8Jrdn0k2Sbxdu7tSonN+vXtNEbtsUPehfEMDFjGtzFbLxdyhuq1das4dNwCrzM3UPSwF5ZGMQ/bC+H3nIWYenVHjry6F5Po+M6G8rt2GwVURPDbBqBFP2obQOeoAMm/wXgBkFf2uIDZ5aOHFlib8SiPLVve1W4qHmwCJ/iToGcFWZk8clVhBJAMBp1vW/5W5uEdxnzO5tiVdpHGWebhNKHi0kssCyUOpnj+rcuT7EhCEwzWIhyRxKpvC0KAQfoUJkZ3fb+FGmgCw5dpXkj8/DlXhDBv52ySWbT5PUmKwY="
key:
secure: "JPPfZgbC3h+KuuQsNH21owvV773Ecpj1AUTy54maToLBChnL54WbkFrmb2yzGYBy3LDSznKCet6S1UZj7iWvrrkYw0fSJhR0ICeDt5cxxg6R8zO4DwsiCeSWSlwnOyFjsaweg7lNI35NvlmtBa21uoP4WZl5zaur+mV49jf8JTYQe2BcUQGq1C+olEXiEv8hMRjWW2N5WGkoJHGovX0NbVbiI/S06vdTmlGFBvfL0ZOOvH7sesGkRk4Gqie61pinsQQKxiz6OETCk8E0dQUP9C3o+ZsiiwSrL/und3RoYLyqb4WKzjqDUPxFfgtWLegIVkhp5/KZywJDUQnQ5h2bSbRHakkrZPu9tFgb9nMQjMa5az5WEaJe3nErFfq6B1fawcCvXkUHrujHETEW56PgR1gENkdxD8us/N4897wtCHOJutBav9V8Wb11PSNJupNR7Ta2+gBVG/pHJP3G9/PrrNopDZf5epyP0DU8bKDYTV8YEJU4rv/BGMqYsShrH5abxB4ofk1hmTg9PQFl/k4tVjlutT8W5Y8Hmjmhgmb4UC1Zy4XaVGWIo3ts5vWWj93KWeCyOm+oSSGbvItT5eT7FMMs2RQHFZ8CDfDpTLqmqMBMwZfF7laL4z4imi2XuEgxSbWTlXCkfxpZaFaWixN2MO1rkg6AzklP2ztvXp1j3eg="
skip_cleanup: true
on:
go: 1.8

View File

@ -3,6 +3,9 @@
DATE=`date --iso-8601=date`
TIME=`date --iso-8601=seconds`
# GITHUB_PULL_REQUEST MUST be set by your own hands.
# See: https://github.com/actions/checkout/issues/58
cat > "./.bintray.json" <<EOF
{
"package": {
@ -22,12 +25,12 @@ cat > "./.bintray.json" <<EOF
"name": "latest",
"desc": "Kompose build from master branch",
"released": "${DATE}",
"vcs_tag": "${TRAVIS_COMMIT}",
"attributes": [{"name": "TRAVIS_JOB_NUMBER", "values" : ["${TRAVIS_JOB_NUMBER}"], "type": "string"},
{"name": "TRAVIS_JOB_ID", "values" : ["${TRAVIS_JOB_ID}"], "type": "string"},
{"name": "TRAVIS_COMMIT", "values" : ["${TRAVIS_COMMIT}"], "type": "string"},
{"name": "TRAVIS_BRANCH", "values" : ["${TRAVIS_BRANCH}"], "type": "string"},
{"name": "TRAVIS_PULL_REQUEST", "values" : ["${TRAVIS_PULL_REQUEST}"], "type": "string"},
"vcs_tag": "${GITHUB_SHA}",
"attributes": [{"name": "GITHUB_RUN_NUMBER", "values" : ["${GITHUB_RUN_NUMBER}"], "type": "string"},
{"name": "GITHUB_RUN_ID", "values" : ["${GITHUB_RUN_ID}"], "type": "string"},
{"name": "GITHUB_SHA", "values" : ["${GITHUB_SHA}"], "type": "string"},
{"name": "GITHUB_REF", "values" : ["${GITHUB_REF}"], "type": "string"},
{"name": "GITHUB_PULL_REQUEST", "values" : ["${GITHUB_PULL_REQUEST}"], "type": "string"},
{"name": "date", "values" : ["${TIME}"], "type": "date"}],
"gpgSign": false
},

View File

@ -1,11 +1,5 @@
#!/usr/bin/env bash
# Ensures that we run on Travis
if [ "$TRAVIS_BRANCH" != "master" ] || [ "$BUILD_DOCS" != "yes" ] || [ "$TRAVIS_SECURE_ENV_VARS" == "false" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
echo "Must be: a merged pr on the master branch, BUILD_DOCS=yes, TRAVIS_SECURE_ENV_VARS=false"
exit 0
fi
DOCS_REPO_NAME="kompose"
DOCS_REPO_URL="git@github.com:kubernetes/kompose.git"
DOCS_KEY="script/deploy_key"
@ -82,7 +76,7 @@ git config user.email "$DOCS_EMAIL"
git add --all
# Check if anything changed, and if it's the case, push to origin/master.
if git commit -m 'Update docs' -m "Commit: https://github.com/kubernetes/kompose/commit/$TRAVIS_COMMIT" ; then
if git commit -m 'Update docs' -m "Commit: https://github.com/kubernetes/kompose/commit/$GITHUB_SHA" ; then
git push
fi

View File

@ -23,7 +23,7 @@ openshift_exit_status=0
convert::start_test "Functional tests on OpenShift"
if [[ -n "${TRAVIS}" ]]; then
if [[ -n "${CI}" ]]; then
install_oc_client
fi