Skip to content

Commit

Permalink
Merge pull request #29 from Iainmon/iain-changes
Browse files Browse the repository at this point in the history
More CI changes
  • Loading branch information
Iainmon authored Feb 3, 2025
2 parents e863636 + 76867a7 commit a447591
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 1 deletion.
93 changes: 93 additions & 0 deletions .github/actions/hello-action/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Container image that runs your code
# FROM ubuntu:latest
# FROM pytorch/pytorch:latest

FROM chapel/chapel
# as chapel

# WORKDIR /ChAI

# COPY ../../. /ChAI/

# RUN echo $(ls -la)
# RUN echo $(ls -la /)
# RUN echo $(ls -la /ChAI)

# Install pytorch
# RUN pip3 install torch numpy torch

# PLEASE SEE {ChAI}/docker/chapel-pytorch-test/.!




#
#
#
#
#
# See docker/chapel-pytorch-test and examine it closely!
#
#
#
#
#
























# RUN echo $(which python3)
# RUN echo $(which chpl)

# RUN echo $(ls -la)

# WORKDIR /ChAI

# RUN echo $(ls -la)

# COPY . .

# RUN chpl test/correspondence/construction/ones/ones.chpl -M lib -o test/correspondence/construction/ones/ones
# RUN chpl test/correspondence/construction/arange/arange.chpl -M lib -o test/correspondence/construction/arange/arange


# RUN echo $(ls -la)

# COPY entrypoint.sh ./entrypoint.sh
# COPY ../../../ ./

# RUN echo $(ls -la)


# Copies your code file from your action repository to the filesystem path `/` of the container
# COPY entrypoint.sh /entrypoint.sh

# RUN chmod +x ./entrypoint.sh

# RUN echo $(which chpl || echo "bad chapel. ")

# RUN ./entrypoint.sh


# Code file to execute when the docker container starts up (`entrypoint.sh`)
# ENTRYPOINT ["/entrypoint.sh"]
15 changes: 15 additions & 0 deletions .github/actions/hello-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
who-to-greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.who-to-greet }}
41 changes: 41 additions & 0 deletions .github/actions/hello-action/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh -l

echo "Hello $1"
time=$(date)
echo "time=$time" >> $GITHUB_OUTPUT

stdout=$(which python3)
echo "python3=$stdout" >> $GITHUB_OUTPUT

stdout=$(which chpl)
echo "chapel=$stdout" >> $GITHUB_OUTPUT





echo "Begin test attempt. "
stdout=$(ls -la)
echo "$stdout"

echo "Running tests."

echo "Trying to compile test from entrypoint.sh. "
chpl test/correspondence/construction/ones/ones.chpl -M lib -o test/correspondence/construction/ones/ones
chpl test/correspondence/construction/arange/arange.chpl -M lib -o test/correspondence/construction/arange/arange

echo "Now running correspondence test. "
echo $(cd test/correspondence && python3 correspondence.py)

echo "End test attempt. "



echo $(pwd)

echo $(which python3 || echo "No python3")
echo $(which chpl || echo "No chpl")


echo $(cd / && ls)

33 changes: 33 additions & 0 deletions .github/workflows/test-dockerfile.__yml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test Docker Image Action (Hello Action)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]


jobs:
hello_world_job:
runs-on: ubuntu-latest
name: A job to say hello
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout
uses: actions/checkout@v4

- name: Hello world action step
uses: ./.github/actions/hello-action # Uses an action in the root directory
id: hello
with:
who-to-greet: 'Mona the Octocat'

# # Use the output from the `hello` step
# # echo "The time was ${{ steps.hello.outputs.time }}"
# # (echo "The python3 path is ${{ steps.hello.outputs.python3 }}" || echo "No python3 found!")
# # (echo "The chapel path is ${{ steps.hello.outputs.chapel }}" || echo "No chapel found!")

# - name: Get the output time
# run: |
# echo "All outputs: ${{ steps.hello.outputs }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ target/
.cls-commands.json
.venv
__pycache__/
!Dockerfile
node_modules/
9 changes: 9 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM chapel/chapel:latest

# Install Python 3, pip, NumPy, Torch
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 python3-pip \
&& pip3 install --no-cache-dir numpy torch \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

17 changes: 17 additions & 0 deletions docker/chapel-pytorch-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM chapel/chapel

# Install pytorch
RUN pip3 install torch

# RUN echo "Hello!"
# RUN echo $(which chpl)

# ADD ./script.sh ./script.sh

WORKDIR /app

COPY ./script.sh script.sh
COPY . ../../.
RUN sh script.sh

# CMD ["sh","script.sh"] # Turn off when testing.
8 changes: 8 additions & 0 deletions docker/chapel-pytorch-test/build-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

docker build --tag 'chapel_pytorch_test' .
docker run -a STDOUT -a STDERR 'chapel_pytorch_test'

# terminal cmd: sh build-run.sh && docker run -it 'chapel_pytorch_test'
# when testing and output of Dockerfile could be unreliable. Having
# this allows you to see the environment produced by the Dockerfile!
7 changes: 7 additions & 0 deletions docker/chapel-pytorch-test/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

echo "Hello!"

echo $(which chpl)

echo $(which python3 || echo "No 'python3' found!")
3 changes: 3 additions & 0 deletions myshell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


echo $(pwd)
3 changes: 2 additions & 1 deletion test/correspondence/correspondence.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def compile_chapel(test_name,test_path,chai_path):
assert test_name == test_path.name
chapel_test_path = test_path / f'{test_name}.chpl'
test_dir = chapel_test_path.parent
os.system(f'chpl {chapel_test_path} -M {chai_path / 'lib'} -o {test_dir / test_name}')
chai_lib_path = chai_path / 'lib'
os.system(f'chpl {chapel_test_path} -M {chai_lib_path} -o {test_dir / test_name}')


def run_chapel_test(test_name,test_path):
Expand Down

0 comments on commit a447591

Please sign in to comment.