Skip to content

Commit

Permalink
Clean up project (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
fivegrant authored Mar 22, 2023
1 parent 81a8715 commit a8f53a4
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/julia-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# Julia Tests

name: Correctness - Julia
on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: 1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
- uses: actions/upload-artifact@v3
with:
name: payloads
path: test/logs/
57 changes: 57 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# Automatically build Docker images on changes to main and push them to a
# Container Registry using HCL Bake file.

name: Build Docker Images
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
push:
branches: ['main']
tags: ['*']

jobs:
# Call the Lint & Format workflow before publishing
verify:
uses: ./.github/workflows/lint.yaml

# Generate a more robust tag for the image
tag-generator:
name: Determine image tag
runs-on: ubuntu-22.04
outputs:
image-tag: ${{ steps.generate.outputs.tag }}
steps:
- name: Generate appropriate tag
id: generate
run: |
if [[ '${{ github.ref_type }}' == 'branch' && '${{ github.ref_name }}' == 'main' ]]; then
TAG=latest
else
SEMVER=$( echo ${{ github.ref_name }} | sed -nre 's/^v[^0-9]*(([0-9]+\.)*[0-9]+(-[a-z]+)?).*/\1/p')
if [[ -n $SEMVER ]]; then
TAG=${SEMVER}
else
TAG=${{ github.ref_name }}
fi
fi
echo "$TAG"
echo "tag=${TAG,,}" >> ${GITHUB_OUTPUT}
- name: Show Generated Tag
run: echo ${{ steps.generate.outputs.tag }}

# Build and Publish all targets associated with specified group
bake:
needs:
- verify
- tag-generator
uses: darpa-askem/.github/.github/workflows/bake-publish.yml@main
with:
file: 'docker/docker-bake.hcl'
group: 'prod'
registry: 'ghcr.io'
organization: ${{ github.repository_owner }}
tag: ${{ needs.tag-generator.outputs.image-tag }}
secrets:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Python ###

# Eclipse
.project
.classpath
Expand Down Expand Up @@ -33,5 +35,9 @@ api.env
# Minio
.minio.sys

### Julia ###
test/logs/

### Project ###
# Config
config.env
2 changes: 1 addition & 1 deletion Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.8.5"
manifest_format = "2.0"
project_hash = "7c273371f028a1fde3fe326deca65beb41affbb7"
project_hash = "cccb141b5a2246189eea16445310ddc452bd40b4"

[[deps.AbstractAlgebra]]
deps = ["GroupsCore", "InteractiveUtils", "LinearAlgebra", "MacroTools", "Markdown", "Random", "RandomExtensions", "SparseArrays", "Test"]
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3 changes: 0 additions & 3 deletions config.env.sample

This file was deleted.

53 changes: 53 additions & 0 deletions docker/docker-back.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
variable "DOCKER_REGISTRY" {
default = "ghcr.io"
}
variable "DOCKER_ORG" {
default = "darpa-askem"
}
variable "VERSION" {
default = "local"
}

# ----------------------------------------------------------------------------------------------------------------------

function "tag" {
params = [image_name, prefix, suffix]
result = [ "${DOCKER_REGISTRY}/${DOCKER_ORG}/${image_name}:${check_prefix(prefix)}${VERSION}${check_suffix(suffix)}" ]
}

function "check_prefix" {
params = [tag]
result = notequal("",tag) ? "${tag}-": ""
}

function "check_suffix" {
params = [tag]
result = notequal("",tag) ? "-${tag}": ""
}

# ----------------------------------------------------------------------------------------------------------------------

group "prod" {
targets = ["simulation-scheduler"]
}

group "default" {
targets = ["simulation-scheduler-base"]
}

# ----------------------------------------------------------------------------------------------------------------------

# Removed linux/arm64 for now to ass CI build - Dec 2022
target "_platforms" {
platforms = ["linux/amd64"]
}

target "simulation-service-base" {
context = ".."
tags = tag("simulation-scheduler", "", "")
dockerfile = "Dockerfile.api"
}

target "simulation-service" {
inherits = ["_platforms", "simulation-service-base"]
}
1 change: 0 additions & 1 deletion src/Scheduler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Transform request body into splattable dict with correct types
"""
function get_args(req::Request)::Dict{Symbol,Any}
args = json(req, Dict{Symbol, Any})
# TODO(five): Make conversions more visible (MOVE TO TOP OF FILE?)
function coerce!(key) # Is there a more idiomatic way of doing this
if haskey(args, key)
args[key] = conversions_for_valid_inputs[key](args[key])
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Test: @test

# TODO(five): Add actual tests for SciML operations
@test 1 == 1

# TODO(five): Add actual tests for scheduler API
@test 2 == 2
Empty file removed tests/__init__.py
Empty file.

0 comments on commit a8f53a4

Please sign in to comment.