Skip to content

Commit a36bdd2

Browse files
authored
Merge pull request #28 from Iainmon/iain-changes
Very basic test. Need to improve.
2 parents 19f1fe3 + 152b955 commit a36bdd2

5 files changed

Lines changed: 174 additions & 0 deletions

File tree

.github/workflows/CI.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
chapel-run-function:
11+
runs-on: ubuntu-latest
12+
container:
13+
image: chapel/chapel:latest
14+
# env:
15+
# ports:
16+
# - 80
17+
# volumes:
18+
# - my_docker_volume:/volume_mount
19+
# options: --cpus 1
20+
steps:
21+
- name: Install Python, pip, and Python libraries
22+
run: |
23+
# # add-apt-repository ppa:qameta/allure
24+
# add-apt-repository ppa:deadsnakes/ppa
25+
# apt-get install -y software-properties-common
26+
# apt-get update -y
27+
apt-get install -y python3
28+
# python3 --version
29+
# python3 -m venv .venv
30+
# source .venv/bin/activate
31+
# which python
32+
python3 -m pip install --upgrade pip
33+
python3 -m pip --version
34+
35+
# pip3 install --no-cache-dir python3-pip
36+
pip3 install --no-cache-dir numpy
37+
pip3 install --no-cache-dir torch
38+
pip3 install --no-cache-dir torchvision
39+
# pip3 install --no-cache-dir virtualenv
40+
- uses: actions/checkout@v4
41+
- name: Check for dockerenv file and Python version
42+
run: |
43+
ls /.dockerenv && echo Found dockerenv
44+
echo "No dockerenv"
45+
python3 --version || echo "Python not found!"
46+
- name: Compile example/vgg
47+
run: |
48+
(cd examples/vgg && chpl test.chpl -M ../../src -M ../../lib -o vgg && python3 dump_weights.py && python3 process_img.py imgs/frog.jpg && ./vgg imgs/frog.chdata)
49+
- name: Run correspondence tests
50+
run: |
51+
(cd test/correspondence && python3 correspondence.py) || echo "Wups! Correspondence bug or more likely test failure!"
52+
- name:
53+
run: |
54+
echo "Pau!"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: build-CI-container
2+
3+
env:
4+
REGISTRY: ghcr.io
5+
# NOTE: IMAGE_NAME must be lowercase
6+
IMAGE_NAME: chai-github-ci
7+
# NOTE: if this filename changes, also update in the on.paths section below
8+
DOCKERFILE: .github/docker/Dockerfile
9+
10+
on:
11+
push:
12+
branches: [ main ]
13+
# This limits the action so it only builds when this file changes
14+
paths:
15+
# unfortunately we can't use ${{env.DOCKERFILE}} here
16+
# see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
17+
- .github/docker/Dockerfile
18+
# also trigger on changes to this workflow file itself
19+
- .github/workflows/build-CI-container.yml
20+
pull_request:
21+
paths:
22+
# same as for pushes above
23+
- .github/docker/Dockerfile
24+
- .github/workflows/build-CI-container.yml
25+
# Adds a "manual run" option in the GH UI
26+
workflow_dispatch:
27+
28+
29+
jobs:
30+
build:
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: read
34+
packages: write
35+
steps:
36+
- name: Checkout Code
37+
uses: actions/checkout@v4
38+
- name: Login to GitHub Container Registry
39+
uses: docker/login-action@v1.14.1
40+
with:
41+
registry: ${{ env.REGISTRY }}
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
- name: Build Docker Image
45+
uses: docker/build-push-action@v2.9.0
46+
with:
47+
file: ${{ env.DOCKERFILE }}
48+
# example: ghcr.io/chapel-lang/chapel-github-ci:latest
49+
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
50+
- name: Push Docker Image if on main
51+
uses: docker/build-push-action@v2.9.0
52+
with:
53+
file: ${{ env.DOCKERFILE }}
54+
push: true
55+
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build and Push Docker
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-push:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v3
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
21+
- name: Log in to GHCR
22+
uses: docker/login-action@v2
23+
with:
24+
registry: ghcr.io
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Build and push
29+
uses: docker/build-push-action@v3
30+
with:
31+
context: ./docker # Folder containing your Dockerfile
32+
file: ./docker/Dockerfile
33+
push: true
34+
tags: ghcr.io/iainmon/chai/chai-github-ci:latest
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
chapel-run-function:
11+
runs-on: ubuntu-latest
12+
container:
13+
# If using Docker Hub:
14+
# image: my-docker-user/my-chapel-python:latest
15+
# Or if using GHCR:
16+
image: ghcr.io/iainmon/chai/chai-github-ci:latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Check Python and Torch
21+
run: |
22+
python3 --version
23+
python3 -c "import torch; print('Torch version:', torch.__version__)"
24+
25+
- name: Compile example/vgg
26+
run: |
27+
cd examples/vgg
28+
chpl test.chpl -M ../../src -M ../../lib -o vgg
29+
30+
- name: Final step
31+
run: echo "Pau!"

examples/vgg/imgs/frog.chdata

588 KB
Binary file not shown.

0 commit comments

Comments
 (0)