-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c17f41
commit 06db0fa
Showing
51 changed files
with
9,277 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,5 @@ | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=postgres | ||
POSTGRES_DB=postgres | ||
POSTGRES_HOSTNAME=localhost | ||
LC_COLLATE=POSIX |
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 @@ | ||
# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.18, 1.17, 1-bullseye, 1.18-bullseye, 1.17-bullseye, 1-buster, 1.18-buster, 1.17-buster | ||
ARG VARIANT=1-bullseye | ||
FROM mcr.microsoft.com/devcontainers/go:0-${VARIANT} | ||
|
||
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 | ||
ARG NODE_VERSION="none" | ||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends libssl-dev postgresql-client python-is-python3 python3-pip python3-dev python3-venv sqlite3 \ | ||
&& pip install pipenv | ||
|
||
# [Optional] Uncomment the next lines to use go get to install anything else you need | ||
# USER vscode | ||
# RUN go get -x <your-dependency-or-tool> | ||
# USER root | ||
|
||
# [Optional] Uncomment this line to install global node packages. | ||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 | ||
|
||
# Install xh | ||
RUN curl -sfL https://raw.githubusercontent.com/ducaale/xh/master/install.sh | XH_BINDIR=/usr/local/bin 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,43 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/go-postgres | ||
{ | ||
"name": "Fasttrack", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
"workspaceFolder": "/workspaces/fasttrack", | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go", | ||
"go.goroot": "/usr/local/go", | ||
"terminal.integrated.defaultProfile.linux": "zsh", | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"golang.Go", | ||
"ms-python.python", | ||
"pbkit.vscode-pbkit", | ||
"redhat.vscode-yaml" | ||
] | ||
} | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [ | ||
5000, | ||
5432 | ||
], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "go version", | ||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode", | ||
"features": { | ||
"ghcr.io/devcontainers/features/git:1": {}, | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"ghcr.io/dhoeric/features/k6:1": {} | ||
} | ||
} |
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,63 @@ | ||
version: '3.8' | ||
|
||
volumes: | ||
home: | ||
workspaces: | ||
postgres-data: | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
# [Choice] Go version 1, 1.18, 1.17 | ||
# Append -bullseye or -buster to pin to an OS version. | ||
# Use -bullseye variants on local arm64/Apple Silicon. | ||
VARIANT: 1.20-bullseye | ||
# Options | ||
NODE_VERSION: "16" | ||
env_file: | ||
# Ensure that the variables in .env match the same variables in devcontainer.json | ||
- .env | ||
|
||
# Security Opt and cap_add allow for C++ based debuggers to work. | ||
# See `runArgs`: https://github.com/Microsoft/vscode-docs/blob/main/docs/remote/devcontainerjson-reference.md | ||
# security_opt: | ||
# - seccomp:unconfined | ||
# cap_add: | ||
# - SYS_PTRACE | ||
|
||
volumes: | ||
- home:/home/vscode | ||
- workspaces:/workspaces | ||
- ..:/workspaces/fasttrack:cached | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. | ||
network_mode: service:db | ||
|
||
# Uncomment the next line to use a non-root user for all processes. | ||
# user: vscode | ||
|
||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
|
||
db: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
env_file: | ||
# Ensure that the variables in .env match the same variables in devcontainer.json | ||
- .env | ||
command: | ||
- postgres | ||
# - -c | ||
# - log_statement=all | ||
|
||
|
||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) |
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,10 @@ | ||
.git | ||
.devcontainer | ||
.venv | ||
.vscode | ||
Dockerfile | ||
fasttrack | ||
fasttrack.db* | ||
pkg/ui/*/build* | ||
!pkg/ui/*/build.sh | ||
tests/*/*.src |
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,190 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
# Run daily at 01:34 so we get notified if CI is broken before a pull request | ||
# is submitted. | ||
- cron: "34 1 * * *" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Read build tags | ||
id: tags | ||
run: echo tags=$(jq -r '."go.buildTags"' .vscode/settings.json) >> $GITHUB_OUTPUT | ||
|
||
- name: Check formatting | ||
run: gofmt -l . | ||
|
||
- name: Mock UI builds | ||
run: | | ||
mkdir pkg/ui/{aim,mlflow}/build | ||
touch pkg/ui/{aim,mlflow}/build/index.html | ||
- name: Check with go vet | ||
run: go vet --tags "${{ steps.tags.outputs.tags }}" ./... | ||
|
||
- uses: dominikh/[email protected] | ||
with: | ||
version: "2022.1.3" | ||
build-tags: ${{ steps.tags.outputs.tags }} | ||
|
||
test: | ||
if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | ||
name: Test | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: test | ||
LC_COLLATE: POSIX | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Mock UI builds | ||
run: | | ||
mkdir pkg/ui/{aim,mlflow}/build | ||
touch pkg/ui/{aim,mlflow}/build/index.html | ||
- name: Run MLFlow integration tests | ||
run: ./tests/mlflow/test.sh | ||
|
||
build-image: | ||
if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | ||
name: Build container image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Compute build args | ||
id: build-args | ||
run: | | ||
echo tags=$(jq -r '."go.buildTags"' .vscode/settings.json) >> $GITHUB_OUTPUT | ||
echo version=$(git describe --tags | sed 's/^v//') >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
# Setup buildx with only one parallel worker. | ||
# This is to avoid OOM during UI build. | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
config-inline: | | ||
[worker.oci] | ||
max-parallelism = 1 | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: fasttrack | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
type=ref,event=pr | ||
type=edge | ||
- name: Build container image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
build-args: | | ||
tags=${{ steps.build-args.outputs.tags }} | ||
version=${{ steps.build-args.outputs.version }} | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
provenance: false | ||
sbom: false | ||
outputs: type=oci,dest=fasttrack-oci.tar | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: fasttrack-oci-image | ||
path: fasttrack-oci.tar | ||
|
||
# Virtual job that can be configured as a required check before a PR can be merged. | ||
all-required-checks-done: | ||
name: All required checks done | ||
needs: | ||
- lint | ||
- test | ||
- build-image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "All required checks done" | ||
|
||
# Publish any push to a branch or tag to ghcr.io as a convenience | ||
# Actual release to Docker Hub happens in a different workflow | ||
push-ghcr: | ||
name: Push to GitHub Container Registry | ||
if: github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
needs: all-required-checks-done | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: fasttrack-oci-image | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Compute repo name | ||
id: repo | ||
run: echo name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT | ||
|
||
- name: Push to GitHub Container Registry | ||
run: | | ||
tags=$(tar -xOf fasttrack-oci.tar index.json | jq -r '.manifests[].annotations."org.opencontainers.image.ref.name"') | ||
for tag in $tags | ||
do | ||
echo "::group::Pushing image to ghcr.io/${{ steps.repo.outputs.name }}:$tag" | ||
skopeo copy --all oci-archive:fasttrack-oci.tar:$tag docker://ghcr.io/${{ steps.repo.outputs.name }}:$tag | ||
echo "::endgroup::" | ||
done |
Oops, something went wrong.