Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing infra #163

Merged
merged 55 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
3e27fb4
add initial testing infra
EthanMarx May 25, 2024
aad3ec3
use container with git
EthanMarx May 25, 2024
1f738f5
revert to python3.10 container
EthanMarx May 25, 2024
452f14a
cd into lib directory
EthanMarx May 25, 2024
d93b88d
cd into lib directory
EthanMarx May 25, 2024
e2bc7fd
remove fail fast
EthanMarx May 25, 2024
479b6b3
remove fail fast
EthanMarx May 25, 2024
3f3ed78
add some debugs
EthanMarx May 25, 2024
ee95640
cd into test dir
EthanMarx May 25, 2024
098ac6c
add basic wavenet tests foor architectures
EthanMarx May 25, 2024
da2cda7
remove priors from libs workflows due to lack of tests
EthanMarx May 25, 2024
c5ee11a
typo in filenam
EthanMarx May 25, 2024
b98f3f8
fix workflow filter
EthanMarx May 25, 2024
98b112d
add pytest to arch deps
EthanMarx May 25, 2024
3948880
add project tests ci
EthanMarx May 25, 2024
ac4d193
get project tests running
EthanMarx May 25, 2024
64ba352
get project tests running
EthanMarx May 25, 2024
748e8ec
get project tests running
EthanMarx May 25, 2024
ad8dec5
get project tests running
EthanMarx May 25, 2024
00d0dfc
get project tests running
EthanMarx May 25, 2024
2943afc
get project tests running
EthanMarx May 25, 2024
d5c72fd
get project tests running
EthanMarx May 25, 2024
b7912e8
get project tests running
EthanMarx May 25, 2024
8709a1b
get project tests running
EthanMarx May 25, 2024
f00a9b7
get project tests running
EthanMarx May 25, 2024
663c13c
get project tests running
EthanMarx May 25, 2024
d2fd021
get project tests running
EthanMarx May 25, 2024
28c5816
get project tests running
EthanMarx May 25, 2024
4ef19c8
get project tests running
EthanMarx May 25, 2024
0401130
get project tests running
EthanMarx May 25, 2024
a33a5e0
run pytest inside container
EthanMarx May 26, 2024
784716a
update data poetry lock
EthanMarx May 26, 2024
59d086f
separate tests and build
EthanMarx May 26, 2024
b3f9e6e
fix syntax errors
EthanMarx May 26, 2024
bbdb829
fix syntax errors
EthanMarx May 26, 2024
f9712c7
fix syntax errors
EthanMarx May 26, 2024
bcdcfde
fix syntax errors
EthanMarx May 26, 2024
0fc1061
fix syntax errors
EthanMarx May 26, 2024
fe3a01b
add pytest as dev dep in data project
EthanMarx May 26, 2024
a565a4a
add train tests
EthanMarx May 26, 2024
49443c0
add infer tests
EthanMarx May 26, 2024
1deb519
add export tests
EthanMarx May 26, 2024
3c5915e
get export tests working
EthanMarx May 26, 2024
b18f742
fix urllib constraint issue in poetry container
EthanMarx May 26, 2024
2e66be2
update infer apptainer file
EthanMarx May 26, 2024
d594000
install pytest inside containers for CI
EthanMarx May 26, 2024
e1b407f
fix injection unit tests
EthanMarx May 26, 2024
dea4b64
call pytest directly in CI
EthanMarx May 26, 2024
da96bf8
tar in same command as tetsts due to permission issues
EthanMarx May 26, 2024
663926c
add debug statement to build
EthanMarx May 26, 2024
ff22dd3
add more debug statements
EthanMarx May 26, 2024
20aeb57
add more debug statements
EthanMarx May 26, 2024
de01490
pin poetry version in infer container
EthanMarx May 26, 2024
dfd8b51
add conditional for docker push to only run on pushes
EthanMarx May 26, 2024
dfd275f
remove debug statements
EthanMarx May 26, 2024
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
25 changes: 25 additions & 0 deletions .github/lib-filters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# define filters for file changes
# to trigger unit tests

# filter for changes
# to workflow
workflow: &workflow
- '.github/lib-filters.yaml'
- '.github/workflows/lib-tests.yaml'


# use paths for filter names
# for simplicity in ci-test.yaml

# cleaner way to run all jobs
# if workflow file is changed?

# libraries
architectures:
- *workflow
- 'libs/architectures/**'
- 'ml4gw/**'

ledger:
- *workflow
- 'libs/ledger/**'
29 changes: 29 additions & 0 deletions .github/project-filters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
workflow: &workflow
- '.github/lib-filters.yaml'
- '.github/workflows/lib-tests.yaml'

data:
- *workflow
- 'projects/data/**'
- 'ml4gw/**'
- 'libs/ledger/**'
- 'libs/priors/**'

infer:
- *workflow
- 'projects/infer/**'
- 'hermes/**'
- 'libs/ledger/**'

train:
- *workflow
- 'projects/train/**'
- 'ml4gw/**'
- 'libs/ledger/**'
- 'libs/architectures/**'

export:
- *workflow
- 'projects/export/**'
- 'ml4gw/**'
- 'hermes/**'
74 changes: 74 additions & 0 deletions .github/workflows/lib-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: library tests

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- main

jobs:
# first job users filters to output which libraries
# and projects have updates that need testing
changes:
runs-on: ubuntu-latest
outputs:
libraries: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: .github/lib-filters.yaml
if: github.event.pull_request.draft == false

# second job takes those outputs and runs
# unit tests on these libs and projects
tests:
runs-on: ubuntu-latest
needs: changes
strategy:
fail-fast: false # is this desired behavior here?
matrix:
library: ${{ fromJSON(needs.changes.outputs.libraries) }}
exclude:
# don't run non-existent .github/workflow tests,
# and exclude projects, whose tests are run in
# a different CI script
- library: 'workflow'
permissions:
packages: read
container:
# container with python and git
image: cicirello/pyaction:4.8
volumes:
- ${{ github.workspace }}:/github/workspace
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

# build the libraries environment
-
name: build environment
env:
test_dir: /github/workspace/libs/${{ matrix.library }}
run: |
python -m pip install poetry
cd $test_dir
poetry install
shell: bash

# run its unit tests inside that environment
-
name: run tests
env:
test_dir: /github/workspace/libs/${{ matrix.library }}
run: |
cd $test_dir
poetry run pytest
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,62 @@
# to convert between the formats in order to handle
# the large memory footprints of our containers without
# toppling over the GitHub runner nodes this executes on.
name: container-build
on:
name: project tests

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- main

env:
REGISTRY: ghcr.io
PATH: /opt/env/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/cuda-11.8/bin:/opt/tritonserver/bin:/usr/local/mpi/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/ucx/bin


jobs:
build:
changes:
runs-on: ubuntu-latest
outputs:
projects: ${{ steps.filter.outputs.changes }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Filter project changes
id: filter
uses: dorny/paths-filter@v2
with:
filters: .github/project-filters.yaml
if: github.event.pull_request.draft == false

build-test:
runs-on: ubuntu-latest
needs: changes
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
project: [train, export, data]
project: ${{ fromJSON(needs.changes.outputs.projects) }}
exclude:
- project: 'workflow' # Fixed the exclusion key
steps:
-
name: Delete huge unnecessary tools folder
name: delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
-
name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Log in to the Container registry
name: log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -44,7 +73,7 @@ jobs:
# in one fell swoop because of permissions discrepancies
# inside and outside the container.
-
name: Build singularity image
name: build singularity image
run: |
docker run \
--rm \
Expand All @@ -53,24 +82,40 @@ jobs:
--privileged \
--entrypoint /bin/bash \
quay.io/singularity/singularity:v3.8.1 \
-c 'singularity build --sandbox /tmp/app apptainer.def && tar -czf /opt/aframe/app.tar.gz -C /tmp/app .'
-c 'singularity build --sandbox /opt/aframe/sandbox apptainer.def'


- name: run tests in singularity sandbox and tar
run: |
docker run \
--rm \
-v ${{ github.workspace }}:/opt/aframe \
--workdir /opt/aframe/projects/${{ matrix.project }} \
--privileged \
--entrypoint /bin/bash \
quay.io/singularity/singularity:v3.8.1 \
-c 'singularity exec --env PATH=${{ env.PATH }} /opt/aframe/sandbox pytest && tar -czf /opt/aframe/app.tar.gz -C /opt/aframe/sandbox .'

# now copy the fs contents into an empty
# container and push it to the registry,
# using a lowercase version of the tag since
# the github environment variables are case-sensitive
# TODO: add step to run tests inside docker


# TODO: currently combining path for nvidia variables
# necessary to launch triton in export container
# with path required by train / data projects.
# Should add conditionals in this workflow to set these dynamically
-
name: build docker image
# only run on pushes
if: ${{ github.event_name == 'push' }}
env:
tag: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.project }}:${{ github.ref_name }}
path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/cuda-11.8/bin:/opt/tritonserver/bin:/usr/local/mpi/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/ucx/bin
run: |
export TAG_LC=${tag,,}
cat app.tar.gz | docker import --change "ENV PATH=${{ env.path }}" - $TAG_LC
cat app.tar.gz | docker import --change "ENV PATH=${{ env.PATH }}" - $TAG_LC
docker push $TAG_LC



2 changes: 1 addition & 1 deletion libs/architectures/architectures/networks/wavenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __init__(
self.init_conv = nn.Conv1d(
in_channels, res_channels, kernel_size=2, dilation=1
)
self.norm1 = norm_layer(res_channels)
self.norm1 = self.norm_layer(res_channels)
self.layers_per_block = layers_per_block
self.num_blocks = num_blocks
self.res_channels = res_channels
Expand Down
97 changes: 96 additions & 1 deletion libs/architectures/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading