-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add GHA and testing infrastructure #1
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,23 @@ | ||
version: 2 | ||
updates: | ||
|
||
# Docker | ||
- package-ecosystem: docker | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
open-pull-requests-limit: 25 | ||
|
||
# Python | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "monthly" | ||
open-pull-requests-limit: 25 | ||
|
||
# GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: ".github/workflows" | ||
schedule: | ||
interval: "monthly" | ||
open-pull-requests-limit: 25 |
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,38 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
push: | ||
# run workflow when merging to main or develop | ||
branches: | ||
- main | ||
- master | ||
- develop | ||
|
||
jobs: | ||
CodeQL-Build: | ||
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
# required for all workflows | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
# Override language selection by uncommenting this and choosing your languages | ||
with: | ||
languages: python | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 |
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,12 @@ | ||
--- | ||
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 | ||
|
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,43 @@ | ||
--- | ||
name: Pull Request Build, Tag, & Push | ||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
- main | ||
- master | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- closed | ||
jobs: | ||
build-develop-open: | ||
if: github.base_ref == 'develop' && github.event.pull_request.merged == false | ||
uses: kbase/.github/.github/workflows/reusable_build.yml@main | ||
secrets: inherit | ||
build-develop-merge: | ||
if: github.base_ref == 'develop' && github.event.pull_request.merged == true | ||
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main | ||
with: | ||
name: '${{ github.event.repository.name }}-develop' | ||
tags: pr-${{ github.event.number }},latest | ||
secrets: inherit | ||
build-main-open: | ||
if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == false | ||
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main | ||
with: | ||
name: '${{ github.event.repository.name }}' | ||
tags: pr-${{ github.event.number }} | ||
secrets: inherit | ||
build-main-merge: | ||
if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == true | ||
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main | ||
with: | ||
name: '${{ github.event.repository.name }}' | ||
tags: pr-${{ github.event.number }},latest-rc | ||
secrets: inherit | ||
trivy-scans: | ||
if: (github.base_ref == 'develop' || github.base_ref == 'main' || github.base_ref == 'master' ) && github.event.pull_request.merged == false | ||
uses: kbase/.github/.github/workflows/reusable_trivy-scans.yml@main | ||
secrets: inherit |
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: Release - Build & Push Image | ||
on: | ||
release: | ||
branches: | ||
- main | ||
- master | ||
types: [ published ] | ||
jobs: | ||
check-source-branch: | ||
uses: kbase/.github/.github/workflows/reusable_validate-branch.yml@main | ||
with: | ||
build_branch: '${{ github.event.release.target_commitish }}' | ||
validate-release-tag: | ||
needs: check-source-branch | ||
uses: kbase/.github/.github/workflows/reusable_validate-release-tag.yml@main | ||
with: | ||
release_tag: '${{ github.event.release.tag_name }}' | ||
build-push: | ||
needs: validate-release-tag | ||
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main | ||
with: | ||
name: '${{ github.event.repository.name }}' | ||
tags: '${{ github.event.release.tag_name }},latest' | ||
secrets: inherit |
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,49 @@ | ||
name: KBase CDM Task Service tests | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
push: | ||
# run workflow when merging to main or develop | ||
branches: | ||
- main | ||
- master | ||
- develop | ||
|
||
jobs: | ||
|
||
task_service_tests: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
|
||
steps: | ||
|
||
- name: Repo checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependecies | ||
shell: bash | ||
run: | | ||
pip install pipenv | ||
pipenv sync --system --dev | ||
|
||
- name: Run tests | ||
shell: bash | ||
run: PYTHONPATH=. pytest --cov=cdmtaskservice --cov-report=xml test | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true |
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,21 @@ | ||
FROM python:3.11 | ||
|
||
RUN mkdir -p /cdmtaskservice | ||
WORKDIR /cdmtaskservice | ||
|
||
# install pipenv | ||
RUN pip install --upgrade pip && \ | ||
pip install pipenv | ||
|
||
# install deps | ||
COPY Pipfile* ./ | ||
RUN pipenv sync --system | ||
|
||
COPY ./ /cdmtaskservice | ||
|
||
# Write the git commit for the service | ||
ARG VCS_REF=no_git_commit_passed_to_build | ||
RUN echo "GIT_COMMIT=\"$VCS_REF\"" > cdmtaskservice/git_commit.py | ||
|
||
ENTRYPOINT ["scripts/entrypoint.sh"] | ||
|
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,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024-present KBase Software | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
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,16 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
|
||
[dev-packages] | ||
pytest = "==8.3.2" | ||
coverage = "==7.6.1" | ||
ipython = "==8.26.0" | ||
pytest-asyncio = "==0.23.8" | ||
pytest-cov = "==5.0.0" | ||
|
||
[requires] | ||
python_version = "3.11" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Standard GHA build and push scripts used everywhere