Skip to content

Commit

Permalink
feat(build): Remove TravisCI and replace with GitHub Actions (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsie committed Mar 13, 2020
1 parent 27d6653 commit e7dbc4a
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 92 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Branch Build

on:
push:
branches:
- master
- version-*

jobs:
branch-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- name: Build
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: ./gradlew -PenablePublishing=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" build snapshot --stacktrace
18 changes: 3 additions & 15 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
name: Front50 CI
name: PR Build

on:
pull_request:
push:
branches:
- master
- release-*
on: [ pull_request ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
# - uses: actions/cache@v1
# with:
# path: ~/.gradle
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
- name: Build
env:
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-java@v1
with:
java-version: 8
- name: Assemble release info
id: release_info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. .github/workflows/release_info.sh ${{ github.event.repository.name }}
echo ::set-output name=CHANGELOG::$(echo -e "${CHANGELOG}")
echo ::set-output name=SKIP_RELEASE::${SKIP_RELEASE}
echo ::set-output name=IS_CANDIDATE::${IS_CANDIDATE}
- name: Candidate build
if: steps.release_info.outputs.IS_CANDIDATE == 'true'
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: |
./gradlew -PenablePublishing=true --info -Prelease.disableGitChecks=true -Prelease.useLastTag=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" candidate
- name: Release build
if: steps.release_info.outputs.IS_CANDIDATE == 'false'
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: |
./gradlew -PenablePublishing=true --info -Prelease.disableGitChecks=true -Prelease.useLastTag=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" final
- name: Create release
if: steps.release_info.outputs.SKIP_RELEASE == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.event.repository.name }} ${{ github.ref }}
body: |
${{ steps.release_info.outputs.CHANGELOG }}
draft: false
prerelease: ${{ steps.release_info.outputs.IS_CANDIDATE }}
31 changes: 31 additions & 0 deletions .github/workflows/release_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -x

# Only look to the latest release to determine the previous tag -- this allows us to skip unsupported tag formats (like `version-1.0.0`)
export PREVIOUS_TAG=`curl --silent "https://api.github.com/repos/spinnaker/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'`
echo "PREVIOUS_TAG=$PREVIOUS_TAG"
export NEW_TAG=${GITHUB_REF/refs\/tags\//}
echo "NEW_TAG=$NEW_TAG"
export CHANGELOG=`git log $NEW_TAG...$PREVIOUS_TAG --oneline`
echo "CHANGELOG=$CHANGELOG"

#Format the changelog so it's markdown compatible
CHANGELOG="${CHANGELOG//$'%'/%25}"
CHANGELOG="${CHANGELOG//$'\n'/%0A}"
CHANGELOG="${CHANGELOG//$'\r'/%0D}"

# If the previous release tag is the same as this tag the user likely cut a release (and in the process created a tag), which means we can skip the need to create a release
export SKIP_RELEASE=`[[ "$PREVIOUS_TAG" = "$NEW_TAG" ]] && echo "true" || echo "false"`

# https://github.com/fsaintjacques/semver-tool/blob/master/src/semver#L5-L14
NAT='0|[1-9][0-9]*'
ALPHANUM='[0-9]*[A-Za-z-][0-9A-Za-z-]*'
IDENT="$NAT|$ALPHANUM"
FIELD='[0-9A-Za-z-]+'
SEMVER_REGEX="\
^[vV]?\
($NAT)\\.($NAT)\\.($NAT)\
(\\-(${IDENT})(\\.(${IDENT}))*)?\
(\\+${FIELD}(\\.${FIELD})*)?$"

# Used in downstream steps to determine if the release should be marked as a "prerelease" and if the build should build candidate release artifacts
export IS_CANDIDATE=`[[ $NEW_TAG =~ $SEMVER_REGEX && ! -z ${BASH_REMATCH[4]} ]] && echo "true" || echo "false"`
6 changes: 3 additions & 3 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pull_request_rules:
- name: Automatically merge on CI success and review
conditions:
- status-success=continuous-integration/travis-ci/pr
- status-success=build
- "label=ready to merge"
- "approved-reviews-by=@oss-approvers"
actions:
Expand All @@ -12,7 +12,7 @@ pull_request_rules:
add: ["auto merged"]
- name: Automatically merge PRs from maintainers on CI success and review
conditions:
- status-success=continuous-integration/travis-ci/pr
- status-success=build
- "label=ready to merge"
- "author=@oss-approvers"
actions:
Expand All @@ -23,7 +23,7 @@ pull_request_rules:
add: ["auto merged"]
- name: Automatically merge kork autobump PRs on CI success
conditions:
- status-success=continuous-integration/travis-ci/pr
- status-success=build
- "label~=autobump-*"
- "author:spinnakerbot"
actions:
Expand Down
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

28 changes: 0 additions & 28 deletions gradle/buildViaTravis.sh

This file was deleted.

19 changes: 0 additions & 19 deletions gradle/installViaTravis.sh

This file was deleted.

4 changes: 0 additions & 4 deletions gradle/prepCaches.sh

This file was deleted.

0 comments on commit e7dbc4a

Please sign in to comment.