Skip to content

Commit 23ec7c1

Browse files
authored
Merge pull request #63 from kbase/dev-add_workflows
SECURITY-59: Add GHA workflows
2 parents e17f604 + efa12c8 commit 23ec7c1

39 files changed

+2390
-715
lines changed

.github/codeql.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Code scanning - action"
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 19 * * 0'
8+
9+
jobs:
10+
CodeQL-Build:
11+
12+
# CodeQL runs on ubuntu-latest and windows-latest
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
# We must fetch at least the immediate parents so that if this is
20+
# a pull request then we can checkout the head.
21+
fetch-depth: 2
22+
23+
# If this run was triggered by a pull request event, then checkout
24+
# the head of the pull request instead of the merge commit.
25+
- run: git checkout HEAD^2
26+
if: ${{ github.event_name == 'pull_request' }}
27+
28+
# Initializes the CodeQL tools for scanning.
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v3
31+
# Override language selection by uncommenting this and choosing your languages
32+
# with:
33+
# languages: go, javascript, csharp, python, cpp, java
34+
35+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
36+
# If this step fails, then you should remove it and run the build manually (see below)
37+
- name: Autobuild
38+
uses: github/codeql-action/autobuild@v3
39+
40+
# ℹ️ Command-line programs to run using the OS shell.
41+
# 📚 https://git.io/JvXDl
42+
43+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
44+
# and modify them (or add more) to build your code if your project
45+
# uses a compiled language
46+
47+
#- run: |
48+
# make bootstrap
49+
# make release
50+
51+
- name: Perform CodeQL Analysis
52+
uses: github/codeql-action/analyze@v3

.github/dependabot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
updates:
3+
4+
# Docker
5+
- package-ecosystem: docker
6+
directory: "/"
7+
schedule:
8+
interval: "monthly"
9+
open-pull-requests-limit: 25
10+
11+
# Python
12+
- package-ecosystem: "pip" # See documentation for possible values
13+
directory: "/" # Location of package manifests
14+
schedule:
15+
interval: "monthly"
16+
open-pull-requests-limit: 25
17+
18+
# GitHub Actions
19+
- package-ecosystem: "github-actions"
20+
directory: ".github/workflows"
21+
schedule:
22+
interval: "monthly"
23+
open-pull-requests-limit: 25

.github/workflows/build-test-push.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/pr_build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Pull Request Build, Tag, & Push
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
- main
8+
- master
9+
types:
10+
- opened
11+
- reopened
12+
- synchronize
13+
- closed
14+
jobs:
15+
build-develop-open:
16+
if: github.base_ref == 'develop' && github.event.pull_request.merged == false
17+
uses: kbase/.github/.github/workflows/reusable_build.yml@main
18+
secrets: inherit
19+
build-develop-merge:
20+
if: github.base_ref == 'develop' && github.event.pull_request.merged == true
21+
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
22+
with:
23+
name: '${{ github.event.repository.name }}-develop'
24+
tags: pr-${{ github.event.number }},latest
25+
secrets: inherit
26+
build-main-open:
27+
if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == false
28+
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
29+
with:
30+
name: '${{ github.event.repository.name }}'
31+
tags: pr-${{ github.event.number }}
32+
secrets: inherit
33+
build-main-merge:
34+
if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == true
35+
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
36+
with:
37+
name: '${{ github.event.repository.name }}'
38+
tags: pr-${{ github.event.number }},latest-rc
39+
secrets: inherit
40+
trivy-scans:
41+
if: (github.base_ref == 'develop' || github.base_ref == 'main' || github.base_ref == 'master' ) && github.event.pull_request.merged == false
42+
uses: kbase/.github/.github/workflows/reusable_trivy-scans.yml@main
43+
secrets: inherit

.github/workflows/release-main.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Release - Build & Push Image
3+
on:
4+
release:
5+
branches:
6+
- main
7+
- master
8+
types: [ published ]
9+
jobs:
10+
check-source-branch:
11+
uses: kbase/.github/.github/workflows/reusable_validate-branch.yml@main
12+
with:
13+
build_branch: '${{ github.event.release.target_commitish }}'
14+
validate-release-tag:
15+
needs: check-source-branch
16+
uses: kbase/.github/.github/workflows/reusable_validate-release-tag.yml@main
17+
with:
18+
release_tag: '${{ github.event.release.tag_name }}'
19+
build-push:
20+
needs: validate-release-tag
21+
uses: kbase/.github/.github/workflows/reusable_build-push.yml@main
22+
with:
23+
name: '${{ github.event.repository.name }}'
24+
tags: '${{ github.event.release.tag_name }},latest'
25+
secrets: inherit
Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,50 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Run tests
4+
name: Run search_api2 tests
55

66
on:
77
pull_request:
8-
branches: [ "*" ]
8+
types:
9+
- opened
10+
- reopened
11+
- synchronize
12+
- ready_for_review
13+
push:
14+
# run workflow when merging to main or develop
15+
branches:
16+
- main
17+
- master
18+
- develop
19+
workflow_dispatch:
920

1021
jobs:
1122
build:
1223
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
python-version: [3.7]
24+
1625
steps:
17-
- uses: actions/checkout@v2
18-
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v2
26+
- name: Check out GitHub repo
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v5
2031
with:
21-
python-version: ${{ matrix.python-version }}
32+
python-version: 3.9.19
33+
2234
- name: Pip installation
2335
run: python -m pip install --upgrade pip poetry
36+
2437
- name: Poetry installation
25-
run: poetry install
38+
run: poetry install --no-root
39+
2640
- name: Create test image
27-
run: docker-compose build
41+
run: docker compose build
42+
2843
- name: Run tests
2944
run: scripts/run_tests
30-
- name: Codecov
31-
uses: codecov/codecov-action@v1
45+
46+
- name: Upload coverage to Codecov
47+
uses: codecov/codecov-action@v5
3248
with:
3349
token: ${{ secrets.CODECOV_TOKEN }}
34-
file: ./coverage.xml
3550
fail_ci_if_error: true

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
- Standard GitHub Actions workflows
10+
11+
### Changed
12+
- Upgraded Python to version 3.9.19 in test workflows and Dockerfile
13+
- Updated integration tests README file
14+
15+
### Fixed
16+
- Container/service shutdown issues; all unit and integration tests now pass locally
17+
18+
### Security
19+
- Vendored `kbase-jsonrpcbase` 0.3.0a6 and `jsonrpc11base` to resolve dependency conflicts
820

921
## [1.0.0] - 2021-04-20
1022
### Fixed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.7-alpine
1+
FROM python:3.9.19-alpine
22

33
# Dockerize related args
44
ARG BUILD_DATE
@@ -27,9 +27,9 @@ WORKDIR /app
2727
# Install dependencies
2828
COPY pyproject.toml poetry.lock /app/
2929
RUN apk --update add --no-cache --virtual build-dependencies libffi-dev libressl-dev musl-dev python3-dev build-base git rust cargo && \
30-
pip install --upgrade pip poetry==1.0.9 && \
30+
pip install --upgrade pip poetry==2.1.2 && \
3131
poetry config virtualenvs.create false && \
32-
poetry install --no-dev --no-interaction --no-ansi && \
32+
poetry install --no-root --without dev --no-interaction --no-ansi && \
3333
apk del --no-cache build-dependencies
3434

3535
COPY . /app

docker-compose.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
# This docker-compose is for developer convenience, not for running in production.
42

53
services:

0 commit comments

Comments
 (0)