Skip to content

Commit

Permalink
Merge pull request #7 from NCATS-Gamma/ci-setup
Browse files Browse the repository at this point in the history
CI setup
  • Loading branch information
Patrick Wang authored Sep 9, 2020
2 parents 0fc11f3 + 919d476 commit e9b0283
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Build and Test'

on: pull_request

jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2

- name: Generate an SSL certificate for testing (silently)
run: openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -subj "/C=US/ST=NC" -keyout test/certs/test.key -out test/certs/test.cert

- name: Build
run: docker build -t robokache .

- name: Test & Get Coverage
run: docker run --name robokache_runner robokache sh -c "go test ./internal/robokache -coverprofile=cover.out"

- name: Copy coverage report from container
run: docker cp robokache_runner:/app/cover.out cover.out

- name: Convert coverage to lcov
uses: jandelgado/[email protected]
with:
infile: cover.out
outfile: cover.lcov

- name: Report coverage as comment in pull request
uses: romeovs/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: ./cover.lcov
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Push to Github Packages'

on:
pull_request:
types: closed
branches:
- main

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages tagged with commit hash.
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
# Uppercase letters are not supported so this is all lowercase
repository: ncats-gamma/robokache/build
tag_with_sha: true
tags: main
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Release a new version to Github Packages'

on: release

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages tagged with "latest" and version number.
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
# Uppercase letters are not supported so this is all lowercase
repository: ncats-gamma/robokache/build
tags: latest,${{ steps.get_version.outputs.VERSION }}

0 comments on commit e9b0283

Please sign in to comment.