split out build from test
use the artifacts from the build stage for testing
move artifacts into folder so threaded uploads can be used
change permissions due of artifacts due to github upload action issue
resolves and part of cas-142
@@ -4,9 +4,12 @@ on:
paths-ignore:
- 'csi/moac/**'
- 'doc/**'
+ push:
+ branches:
+ - master
jobs:
Build:
- name: Build and run tests
+ name: Build and run cargo tests
runs-on: self-hosted
timeout-minutes: 20
container:
@@ -27,7 +30,33 @@ jobs:
- run: ( cd jsonrpc && cargo test )
- run: ( cd nvmeadm && cargo test )
- run: ( cd mayastor && cargo test -- --test-threads=1 )
- - run: ( cd mayastor-test && npm install && ./node_modules/mocha/bin/mocha test_cli.js )
+ - run: ( cd nvmeadm && cargo test )
+ - run: mkdir ./target/debug/github-artifacts/
+ - run: ( cd ./target/debug/ && cp mayastor mayastor-client mayastor-agent spdk initiator mctl github-artifacts/ )
+ - uses: actions/upload-artifact@v2-preview
+ with:
+ name: mayastor
+ path: ./target/debug/github-artifacts
+ Test:
+ needs: Build
+ name: Run mocha tests
+ runs-on: ubuntu-latest
+ container:
+ image: docker.io/mayadata/ms-buildenv:nix
+ options: --privileged -v /dev:/dev -v /bin:/host/bin -v /lib/modules:/lib/modules --cpus 2
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/download-artifact@v2-preview
+ with:
+ name: mayastor
+ path: ./target/debug
+ - run: ( cd target/debug/ && chmod a+x mayastor mayastor-client mayastor-agent spdk initiator mctl )
+ - run: ln -s /host/bin/kmod /bin/modprobe
+ - run: /bin/modprobe nbd
+ - run: /bin/modprobe xfs
+ - run: echo 2048 | tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
+ - run: ( cd mayastor-test && npm install)
+ - run: ( cd mayastor-test && ./node_modules/mocha/bin/mocha test_cli.js )
- run: ( cd mayastor-test && ./node_modules/mocha/bin/mocha test_replica.js )
- run: ( cd mayastor-test && TEST_PORT=10125 ./node_modules/mocha/bin/mocha test_replica.js )
- run: ( cd mayastor-test && ./node_modules/mocha/bin/mocha test_csi.js )
@@ -37,7 +66,7 @@ jobs:
- run: ( cd mayastor-test && TEST_PORT=10125 ./node_modules/mocha/bin/mocha test_rebuild.js )
Image:
# dont image if the build fails
- needs: Build
+ needs: Test
name: Build docker images
runs-on: ubuntu-latest
steps:
