mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-09 02:54:05 +00:00
Build contributed recipes in PRs (#2212)
* Build contributed recipes in PRs * Fix GitHub matrix
This commit is contained in:
@@ -2,24 +2,39 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
THIS_DIR = Path(__file__).parent.resolve()
|
||||
REPOSITORY_OWNER = os.environ["REPOSITORY_OWNER"]
|
||||
|
||||
|
||||
def generate_matrix() -> dict[str, Any]:
|
||||
dockerfiles = sorted(file.name for file in THIS_DIR.glob("*.dockerfile"))
|
||||
def generate_matrix() -> Any:
|
||||
dockerfiles = sorted(THIS_DIR.glob("*.dockerfile"))
|
||||
runs_on = ["ubuntu-24.04", "ubuntu-22.04-arm"]
|
||||
return {
|
||||
"dockerfile": dockerfiles,
|
||||
"runs-on": runs_on,
|
||||
"exclude": [
|
||||
{"dockerfile": "oracledb.dockerfile", "runs-on": "ubuntu-22.04-arm"}
|
||||
],
|
||||
}
|
||||
|
||||
configurations = []
|
||||
for dockerfile in dockerfiles:
|
||||
dockerfile_name = dockerfile.name
|
||||
for run in runs_on:
|
||||
if dockerfile_name == "oracledb.dockerfile" and run == "ubuntu-22.04-arm":
|
||||
continue
|
||||
dockerfile_lines = dockerfile.read_text().splitlines()
|
||||
base_image = [
|
||||
line for line in dockerfile_lines if line.startswith("ARG BASE_IMAGE=")
|
||||
][0][15:]
|
||||
base_image_short = base_image[base_image.rfind("/") + 1 :]
|
||||
# Handling a case of `docker.io/jupyter/base-notebook:notebook-6.5.4` image
|
||||
if ":" in base_image_short:
|
||||
base_image_short = ""
|
||||
configurations.append(
|
||||
{
|
||||
"dockerfile": dockerfile_name,
|
||||
"runs-on": run,
|
||||
"platform": "x86_64" if run == "ubuntu-24.04" else "aarch64",
|
||||
"parent-image": base_image_short,
|
||||
}
|
||||
)
|
||||
return {"include": configurations}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user