Skip to content

Commit 0fe8f83

Browse files
committed
Initial Release
0 parents  commit 0fe8f83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4965
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "build-python"
2+
description: "Action to build a Python and uv environment."
3+
4+
inputs:
5+
python-version:
6+
required: true
7+
description: "The python version to use"
8+
9+
context-directory:
10+
required: true
11+
description: "The context directory to use"
12+
default: "."
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Set up python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: ${{ inputs.python-version }}
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
enable-cache: true
26+
cache-dependency-glob: "${{ inputs.context-directory }}/uv.lock"
27+
28+
- name: Restore uv cache
29+
uses: actions/cache@v4
30+
with:
31+
path: ${{ github.workspace }}/.uv-cache
32+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
33+
restore-keys: |
34+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
35+
uv-${{ runner.os }}
36+
37+
- name: Install Dependencies
38+
working-directory: ${{ inputs.context-directory }}
39+
run: uv sync
40+
shell: bash
41+
env:
42+
UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache
43+
44+
- name: Minimize uv cache
45+
run: uv cache prune --ci
46+
shell: bash
47+
env:
48+
UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache
49+
50+
- name: Make Check
51+
working-directory: ${{ inputs.context-directory }}
52+
run: make check
53+
shell: bash
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: "package-container"
2+
description: "Composite action to to build a docker image."
3+
4+
inputs:
5+
IMAGE_NAME:
6+
required: true
7+
description: "The name of the image"
8+
FOLDER_PATH:
9+
required: true
10+
description: "The context path to build the docker"
11+
DOCKERFILE:
12+
required: false
13+
description: "The path to the Dockerfile"
14+
default: "Dockerfile"
15+
TOKEN:
16+
description: "A Github PAT"
17+
required: true
18+
USERNAME:
19+
description: "A Github PAT username"
20+
required: true
21+
ORGANIZATION_NAME:
22+
description: "The organization name"
23+
required: true
24+
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Create a new tag
29+
id: tag
30+
uses: anothrNick/github-tag-action@1.69.0
31+
if: github.ref == 'refs/heads/main'
32+
env:
33+
GITHUB_TOKEN: ${{ inputs.TOKEN }}
34+
WITH_V: "true"
35+
DEFAULT_BUMP: patch
36+
37+
- name: Docker meta
38+
id: meta
39+
uses: docker/metadata-action@v5
40+
with:
41+
images: ghcr.io/${{inputs.ORGANIZATION_NAME}}/${{inputs.IMAGE_NAME}}
42+
tags: |
43+
type=sha
44+
type=ref,event=branch
45+
type=ref,event=pr
46+
type=semver,pattern={{version}}
47+
type=semver,pattern={{major}}.{{minor}}
48+
type=raw,value=latest,enable={{is_default_branch}}
49+
50+
- name: Log in to the Container registry
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ghcr.io
54+
username: ${{ inputs.USERNAME }}
55+
password: ${{ inputs.TOKEN }}
56+
57+
- name: Set up Docker Buildx
58+
uses: docker/setup-buildx-action@v3
59+
60+
- name: Build and push (non-main branches)
61+
uses: docker/build-push-action@v5
62+
if: github.ref != 'refs/heads/main'
63+
with:
64+
context: ${{ inputs.FOLDER_PATH }}
65+
file: "${{ inputs.FOLDER_PATH }}/${{ inputs.DOCKERFILE }}"
66+
platforms: linux/amd64,linux/arm64
67+
push: true
68+
tags: ${{ steps.meta.outputs.tags }}
69+
labels: ${{ steps.meta.outputs.labels }}
70+
71+
- name: Build and push (main branch)
72+
uses: docker/build-push-action@v5
73+
if: github.ref == 'refs/heads/main'
74+
with:
75+
context: ${{ inputs.FOLDER_PATH }}
76+
file: "${{ inputs.FOLDER_PATH }}/${{ inputs.DOCKERFILE }}"
77+
platforms: linux/amd64,linux/arm64
78+
push: true
79+
tags: ${{ steps.meta.outputs.tags }},ghcr.io/${{inputs.ORGANIZATION_NAME}}/${{inputs.IMAGE_NAME}}:${{ steps.tag.outputs.new_tag }}
80+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/cd.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CD"
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
# Allow subsequently queued workflows to cancel previous runs
8+
concurrency:
9+
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} - CI"
10+
cancel-in-progress: true
11+
12+
env:
13+
FORCE_COLOR: "1"
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out
20+
uses: actions/checkout@v4
21+
22+
build-1trc-notebook-container:
23+
name: Build notebook containers
24+
environment: dev
25+
runs-on: ubuntu-latest
26+
permissions:
27+
packages: write
28+
contents: write
29+
if: github.event.pull_request.draft == false
30+
steps:
31+
- name: Checkout Actions Repository
32+
uses: actions/checkout@v4
33+
34+
- name: 1trc-notebook
35+
uses: ./.github/actions/package-container
36+
with:
37+
FOLDER_PATH: .
38+
IMAGE_NAME: 1trc-notebook
39+
USERNAME: ${{ github.actor }}
40+
ORGANIZATION_NAME: ${{ vars.CONTAINER_REPOSITORY_OWNER }}
41+
TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "CI"
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
# Allow subsequently queued workflows to cancel previous runs
8+
concurrency:
9+
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} - CI"
10+
cancel-in-progress: true
11+
12+
env:
13+
FORCE_COLOR: "1"
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out
20+
uses: actions/checkout@v4
21+
22+
py-1trc-notebook:
23+
runs-on: ubuntu-latest
24+
needs: build
25+
steps:
26+
- name: Check out
27+
uses: actions/checkout@v4
28+
29+
- name: py-1trc-notebook
30+
uses: ./.github/actions/build-python
31+
with:
32+
context-directory: .
33+
python-version: 3.11

0 commit comments

Comments
 (0)