-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added workflows for building, testing, releasing (#16)
* added workflows * settings fix * skip integration tests in CI
- Loading branch information
Showing
7 changed files
with
143 additions
and
1 deletion.
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,14 @@ | ||
DATASOURCE_DB_USERNAME=postgres | ||
DATASOURCE_DB_PASSWORD=postgres | ||
DATASOURCE_DB_DATABASE=hutch-omop | ||
DATASOURCE_DB_SCHEMA=public | ||
DATASOURCE_DB_PORT=5432 | ||
DATASOURCE_DB_HOST=localhost | ||
TASK_API_BASE_URL=https://brcdatarq.nottingham.ac.uk/link_connector_api | ||
TASK_API_USERNAME=link-test | ||
TASK_API_PASSWORD=zjC/FKL91V9QIwuRsfXtcGK9LfU= | ||
COLLECTION_ID=RQ-CC-98ac1cb4-b34f-4131-a393-3936e7a946cf | ||
TASK_API_TYPE=a | ||
LOW_NUMBER_SUPPRESSION_THRESHOLD= | ||
ROUNDING_TARGET= | ||
POLLING_INTERVAL=5 |
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: Check Container Builds | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
- name: Build Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: false | ||
platforms: linux/amd64,linux/arm64 |
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,30 @@ | ||
name: Run Tests | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
run-tests: | ||
name: Run Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
version: "0.5.16" | ||
enable-cache: true | ||
cache-dependency-glob: "uv.lock" | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: ".python-version" | ||
|
||
- name: uv sync | ||
run: uv sync --frozen --dev | ||
|
||
- name: Run tests | ||
run: uv run pytest tests |
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,65 @@ | ||
# This workflow is used for any merge to main and results in a built container image being pushed and tagged as a dev release | ||
# with commit hash and timestamp tags | ||
# | ||
# These are not stable or pre-release semver releases! | ||
name: Publish a Dev Release | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
env: | ||
image-name: hutch/bunny | ||
repo-owner: ${{ github.repository_owner }} | ||
registry: ghcr.io | ||
|
||
jobs: | ||
publish-bunny: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
- name: Docker Login | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ${{ env.registry }} | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Set timestamp env var | ||
run: echo "RUN_TIMESTAMP=$(TZ="Etc/UTC" date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
|
||
- name: Docker Metadata action | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.registry }}/${{ env.repo-owner}}/${{ env.image-name}} | ||
tags: | | ||
${{ github.sha }} | ||
${{ env.RUN_TIMESTAMP }} | ||
dev-latest | ||
labels: | | ||
org.opencontainers.image.title=Hutch Bunny | ||
org.opencontainers.image.vendor=University of Nottingham | ||
org.opencontainers.image.version=0.0.1 | ||
# TODO: version label should reflect current source version? | ||
# Could add more custom labels in the future here | ||
|
||
- name: Build and push Docker images | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
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
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