Skip to content

Commit

Permalink
Merge pull request #369 from kbase/add_gha_build
Browse files Browse the repository at this point in the history
DEVOPS-1197: Add GHA actions
  • Loading branch information
bio-boris authored Feb 16, 2023
2 parents 07a0a3c + 8b2d1e6 commit f22afe7
Show file tree
Hide file tree
Showing 4 changed files with 265 additions and 186 deletions.
372 changes: 186 additions & 186 deletions .github/workflows/kb_sdk-actions.yml
Original file line number Diff line number Diff line change
@@ -1,187 +1,187 @@
name: Basic kb-sdk tests

on:
[push, pull_request]

jobs:

test_kb-sdk_builds:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
language: [perl, python, java]
test_type: [base, example]
auth: [token, env_var]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build with Ant
run: |
make
- name: Add bin to $PATH
run: |
echo "::add-path::$GITHUB_WORKSPACE/bin"
- name: checking kb-sdk functions
env:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
LANGUAGE_TOKEN: ${{ matrix.language }}
run: |
env
kb-sdk help
kb-sdk version
- name: init base repo
if: matrix.test_type == 'base'
env:
LANGUAGE_TOKEN: ${{ matrix.language }}
run: |
kb-sdk init -l $LANGUAGE_TOKEN -u user SampleApp
- name: init example repo
if: matrix.test_type == 'example'
env:
LANGUAGE_TOKEN: ${{ matrix.language }}
run: |
kb-sdk init -l $LANGUAGE_TOKEN -u user --example SampleApp
- name: test ${{ matrix.test_type }} repo, using test.cfg for auth
if: matrix.auth == 'token'
run: |
cd SampleApp
kb-sdk test || true
- name: test ${{ matrix.test_type }} repo, using test.cfg for auth
if: matrix.auth == 'token'
env:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
run: |
cd SampleApp
sed -i "s/test_token=/test_token=$KBASE_TEST_TOKEN/" test_local/test.cfg
kb-sdk test
- name: test ${{ matrix.test_type }} repo, using env var for auth
if: matrix.auth == 'env_var'
env:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
run: |
cd SampleApp
kb-sdk test
- name: make resulting app available as artefact in case of failure
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: kbaseapp-${{ matrix.language }}-${{ matrix.test_type }}-${{ matrix.os }}
path: SampleApp


test_existing_repos:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
app: [WsLargeDataIO, KBaseReport]
auth: [token, env_var]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build with Ant
run: |
make
- name: Add bin to $PATH
run: |
echo "::add-path::$GITHUB_WORKSPACE/bin"
- name: checking basic kb-sdk functions
run: |
env
kb-sdk help
kb-sdk version
- name: Checkout existing kbase module ${{ matrix.app }}
uses: actions/checkout@v2
with:
repository: kbaseapps/${{ matrix.app }}
path: kbase_app

- name: run repo tests, using test.cfg for auth
if: matrix.auth == 'token'
run: |
cd kbase_app
kb-sdk test || true
- name: run repo tests, using test.cfg for auth
if: matrix.auth == 'token'
env:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
run: |
cd kbase_app
sed -i "s/test_token=/test_token=$KBASE_TEST_TOKEN/" test_local/test.cfg
kb-sdk test
- name: run repo tests, using env var for auth
if: matrix.auth == 'env_var'
env:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
run: |
cd kbase_app
kb-sdk test
- name: make resulting app available as artefact in case of failure
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: kbaseapp-${{ matrix.app }}-${{ matrix.os }}
path: kbase_app

dockerhub_upload:
runs-on: ubuntu-latest
if: |
(github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master') &&
github.event_name == 'push' &&
!contains(github.event.head_commit.message, 'skip docker') &&
!contains(github.event.head_commit.message, 'skip ci')
needs:
- test_existing_repos
- test_kb-sdk_builds

steps:
- name: checkout git repo
uses: actions/checkout@v2

- name: set current branch name as TAG_NAME for docker image
shell: bash
run: echo "::set-env name=TAG_NAME::${GITHUB_REF#refs/heads/}"

- name: build and push to dockerhub
uses: opspresso/action-docker@master
with:
args: --docker
env:
USERNAME: ${{ secrets.DOCKER_USERNAME }}
PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERFILE: "Dockerfile"
IMAGE_NAME: "kbase/kb-sdk"
# name: Basic kb-sdk tests

# on:
# [push, pull_request]

# jobs:

# test_kb-sdk_builds:
# if: "!contains(github.event.head_commit.message, 'skip ci')"
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
# language: [perl, python, java]
# test_type: [base, example]
# auth: [token, env_var]

# steps:
# - name: Checkout
# uses: actions/checkout@v2

# - name: Set up JDK 1.8
# uses: actions/setup-java@v1
# with:
# java-version: 1.8

# - name: Build with Ant
# run: |
# make

# - name: Add bin to $PATH
# run: |
# echo "::add-path::$GITHUB_WORKSPACE/bin"

# - name: checking kb-sdk functions
# env:
# KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
# LANGUAGE_TOKEN: ${{ matrix.language }}
# run: |
# env
# kb-sdk help
# kb-sdk version

# - name: init base repo
# if: matrix.test_type == 'base'
# env:
# LANGUAGE_TOKEN: ${{ matrix.language }}
# run: |
# kb-sdk init -l $LANGUAGE_TOKEN -u user SampleApp

# - name: init example repo
# if: matrix.test_type == 'example'
# env:
# LANGUAGE_TOKEN: ${{ matrix.language }}
# run: |
# kb-sdk init -l $LANGUAGE_TOKEN -u user --example SampleApp

# - name: test ${{ matrix.test_type }} repo, using test.cfg for auth
# if: matrix.auth == 'token'
# run: |
# cd SampleApp
# kb-sdk test || true

# - name: test ${{ matrix.test_type }} repo, using test.cfg for auth
# if: matrix.auth == 'token'
# env:
# KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
# run: |
# cd SampleApp
# sed -i "s/test_token=/test_token=$KBASE_TEST_TOKEN/" test_local/test.cfg
# kb-sdk test

# - name: test ${{ matrix.test_type }} repo, using env var for auth
# if: matrix.auth == 'env_var'
# env:
# KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
# run: |
# cd SampleApp
# kb-sdk test

# - name: make resulting app available as artefact in case of failure
# if: ${{ failure() }}
# uses: actions/upload-artifact@v2
# with:
# name: kbaseapp-${{ matrix.language }}-${{ matrix.test_type }}-${{ matrix.os }}
# path: SampleApp


# test_existing_repos:
# if: "!contains(github.event.head_commit.message, 'skip ci')"
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
# app: [WsLargeDataIO, KBaseReport]
# auth: [token, env_var]

# steps:
# - name: Checkout
# uses: actions/checkout@v2

# - name: Set up JDK 1.8
# uses: actions/setup-java@v1
# with:
# java-version: 1.8

# - name: Build with Ant
# run: |
# make

# - name: Add bin to $PATH
# run: |
# echo "::add-path::$GITHUB_WORKSPACE/bin"

# - name: checking basic kb-sdk functions
# run: |
# env
# kb-sdk help
# kb-sdk version

# - name: Checkout existing kbase module ${{ matrix.app }}
# uses: actions/checkout@v2
# with:
# repository: kbaseapps/${{ matrix.app }}
# path: kbase_app

# - name: run repo tests, using test.cfg for auth
# if: matrix.auth == 'token'
# run: |
# cd kbase_app
# kb-sdk test || true

# - name: run repo tests, using test.cfg for auth
# if: matrix.auth == 'token'
# env:
# KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
# run: |
# cd kbase_app
# sed -i "s/test_token=/test_token=$KBASE_TEST_TOKEN/" test_local/test.cfg
# kb-sdk test

# - name: run repo tests, using env var for auth
# if: matrix.auth == 'env_var'
# env:
# KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
# run: |
# cd kbase_app
# kb-sdk test

# - name: make resulting app available as artefact in case of failure
# if: ${{ failure() }}
# uses: actions/upload-artifact@v2
# with:
# name: kbaseapp-${{ matrix.app }}-${{ matrix.os }}
# path: kbase_app

# dockerhub_upload:
# runs-on: ubuntu-latest
# if: |
# (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master') &&
# github.event_name == 'push' &&
# !contains(github.event.head_commit.message, 'skip docker') &&
# !contains(github.event.head_commit.message, 'skip ci')
# needs:
# - test_existing_repos
# - test_kb-sdk_builds

# steps:
# - name: checkout git repo
# uses: actions/checkout@v2

# - name: set current branch name as TAG_NAME for docker image
# shell: bash
# run: echo "::set-env name=TAG_NAME::${GITHUB_REF#refs/heads/}"

# - name: build and push to dockerhub
# uses: opspresso/action-docker@master
# with:
# args: --docker
# env:
# USERNAME: ${{ secrets.DOCKER_USERNAME }}
# PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# DOCKERFILE: "Dockerfile"
# IMAGE_NAME: "kbase/kb-sdk"

11 changes: 11 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Manual Build & Push
on:
workflow_dispatch:
jobs:
build-push:
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
with:
name: '${{ github.event.repository.name }}-develop'
tags: br-${{ github.ref_name }}
secrets: inherit
Loading

0 comments on commit f22afe7

Please sign in to comment.