10000 chore: removed travis yml and added git action support by mnoman09 · Pull Request #469 · optimizely/java-sdk · GitHub
[go: up one dir, main page]

Skip to content

chore: removed travis yml and added git action support #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
8000
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Reusable action of building snapshot and publish

on:
workflow_call:
inputs:
action:
required: true
type: string
travis_tag:
required: true
type: string
secrets:
MAVEN_SIGNING_KEY_BASE64:
required: true
MAVEN_SIGNING_PASSPHRASE:
required: true
MAVEN_CENTRAL_USERNAME:
required: true
MAVEN_CENTRAL_PASSWORD:
required: true
jobs:
run_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: ${{ inputs.action }}
env:
MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }}
MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
run: TRAVIS_TAG=${{ inputs.travis_tag }} ./gradlew ${{ inputs.action }}
56 changes: 56 additions & 0 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Reusable action of running integration of production suite

on:
workflow_call:
inputs:
FULLSTACK_TEST_REPO:
required: false
type: string
secrets:
CI_USER_TOKEN:
required: true
TRAVIS_COM_TOKEN:
required: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# You should create a personal access token and store it in your repository
token: ${{ secrets.CI_USER_TOKEN }}
repository: 'optimizely/travisci-tools'
path: 'home/runner/travisci-tools'
ref: 'master'
- name: set SDK Branch if PR
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
- name: set SDK Branch if not pull request
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Trigger build
env:
SDK: java
FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }}
BUILD_NUMBER: ${{ github.run_id }}
TESTAPP_BRANCH: master
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_EVENT_TYPE: ${{ github.event_name }}
GITHUB_CONTEXT: ${{ toJson(github) }}
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }}
UPSTREAM_REPO: ${{ github.repository }}
TRAVIS_COMMIT: ${{ github.sha }}
TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }}
UPSTREAM_SHA: ${{ github.sha }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
EVENT_MESSAGE: ${{ github.event.message }}
HOME: 'home/runner'
run: |
echo "$GITHUB_CONTEXT"
home/runner/travisci-tools/trigger-script-with-status-update.sh
116 changes: 116 additions & 0 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

name: Java CI with Gradle

on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
SNAPSHOT:
type: boolean
description: Set SNAPSHOT true to publish

jobs:
lint_markdown_files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install gem
run: |
gem install awesome_bot
- name: Run tests
run: find . -type f -name '*.md' -exec awesome_bot {} \;

integration_tests:
uses: optimizely/java-sdk/.github/workflows/integration_test.yml@master
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}

fullstack_production_suite:
uses: optimizely/java-sdk/.github/workflows/integration_test.yml@master
with:
FULLSTACK_TEST_REPO: ProdTesting
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}

test:
if: startsWith(github.ref, 'refs/tags/') != true
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jdk: [8, 9]
optimizely_default_parser: [GSON_CONFIG_PARSER, JACKSON_CONFIG_PARSER, JSON_CONFIG_PARSER, JSON_SIMPLE_CONFIG_PARSER]
steps:
- name: checkout
uses: actions/checkout@v2

- name: set up JDK ${{ matrix.jdk }}
uses: AdoptOpenJDK/install-jdk@v1
with:
version: ${{ matrix.jdk }}
architecture: x64

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- name: run tests
id: unit_tests
env:
optimizely_default_parser: ${{ matrix.optimizely_default_parser }}
run: |
./gradlew clean
./gradlew exhaustiveTest
./gradlew build
- name: Check on failures
if: steps.unit_tests.outcome != 'success'
run: |
cat /home/runner/java-sdk/core-api/build/reports/findbugs/main.html
cat /home/runner/java-sdk/core-api/build/reports/findbugs/test.html
- name: Check on success
if: steps.unit_tests.outcome == 'success'
run: |
./gradlew coveralls uploadArchives --console plain

publish:
if: startsWith(github.ref, 'refs/tags/')
uses: optimizely/java-sdk/.github/workflows/build.yml@master
with:
action: ship
travis_tag: ${GITHUB_REF#refs/*/}
secrets:
MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }}
MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

snapshot:
if: ${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }}
uses: optimizely/java-sdk/.github/workflows/build.yml@master
with:
action: ship
travis_tag: BB-SNAPSHOT
secrets:
MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }}
MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
16 changes: 16 additions & 0 deletions .github/workflows/source_clear_cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Source clear

on:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add master branch here.

schedule:
# Runs "weekly"
- cron: '0 0 * * 0'

jobs:
source_clear:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Source clear scan
env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan
92 changes: 0 additions & 92 deletions .travis.yml

This file was deleted.

0