Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM rust:1-bookworm

# Install build and OpenCL headers (compile-time), BLAS/LAPACK, git, curl
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
git \
curl \
ocl-icd-opencl-dev \
clinfo \
libblas-dev \
liblapack-dev \
&& rm -rf /var/lib/apt/lists/*

# Set a default workdir used by Dev Containers / Codespaces
WORKDIR /workspaces/ha-ndarray

19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "ha-ndarray",
"build": {
"dockerfile": "Dockerfile"
},
"remoteUser": "root",
"containerEnv": {
"RUST_BACKTRACE": "1"
},
"postCreateCommand": "rustup component add clippy rustfmt && cargo fetch",
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml"
]
}
}
}
35 changes: 35 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Dev Container

on:
pull_request:
push:
branches: [ devcontainer-codespaces ]

jobs:
build-devcontainer:
name: Build .devcontainer/Dockerfile (${{ matrix.platform }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform: [ linux/amd64, linux/arm64 ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU (emulation for non-native arch)
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build (cache-enabled)
uses: docker/build-push-action@v5
with:
context: .
file: .devcontainer/Dockerfile
platforms: ${{ matrix.platform }}
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
52 changes: 52 additions & 0 deletions .github/workflows/notify-devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Notify Devcontainer Status

on:
workflow_run:
workflows: ["Dev Container"]
types: [completed]

jobs:
notify:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
actions: read
steps:
- name: Comment PR with results
uses: actions/github-script@v7
with:
script: |
const run = context.payload.workflow_run;
const { data } = await github.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id,
per_page: 100,
});

const lines = (data.jobs || []).map(j => `- ${j.name}: ${j.conclusion}`);
const body = [
`Dev Container workflow completed: ${run.conclusion}`,
``,
`Jobs:`,
...lines,
``,
`Run: ${run.html_url}`,
].join('\n');

const prs = run.pull_requests || [];
if (prs.length === 0) {
core.info('No associated PRs to notify.');
return;
}

for (const pr of prs) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body,
});
}