-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from NCATS-Gamma/ci-setup
CI setup
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |