From 08382d3c5793c3b2d77963aa9832d2633b1c06e0 Mon Sep 17 00:00:00 2001 From: Ryan Bottriell Date: Fri, 1 Apr 2022 20:28:59 -0700 Subject: [PATCH] Update github actions to also test rust under spfs Signed-off-by: Ryan Bottriell --- .github/workflows/rust.yml | 42 ---------------------- .github/workflows/{python.yml => test.yml} | 25 +++++++++---- Makefile | 5 +-- examples/_test.py | 3 ++ 4 files changed, 23 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/rust.yml rename .github/workflows/{python.yml => test.yml} (68%) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index ae417719db..0000000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Rust - -on: - pull_request: - branches: [master] - push: - branches: [master] - -env: - CARGO_TERM_COLOR: always - -jobs: - lint: - runs-on: ubuntu-latest - env: - SPFS_PULL_USERNAME: ${{ secrets.SPFS_PULL_USERNAME }} - SPFS_PULL_PASSWORD: ${{ secrets.SPFS_PULL_PASSWORD }} - steps: - - uses: actions/checkout@v2 - - name: Check Rust Formatting - run: cargo fmt -- --check - - run: sudo apt-get install -y libcap-dev - - name: Patch spfs Pull Auth - run: sed -i "s|github.com|$SPFS_PULL_USERNAME:$SPFS_PULL_PASSWORD@github.com|" Cargo.toml - - name: Lint Rust Code with Clippy - run: make lint-rust - build_and_test: - runs-on: ubuntu-18.04 - env: - SPFS_PULL_USERNAME: ${{ secrets.SPFS_PULL_USERNAME }} - SPFS_PULL_PASSWORD: ${{ secrets.SPFS_PULL_PASSWORD }} - steps: - - uses: actions/checkout@v2 - - run: sudo apt-get install -y libcap-dev tcsh - - run: sudo pip3 install pipenv - - name: Patch spfs Pull Auth - run: sed -i "s|github.com|$SPFS_PULL_USERNAME:$SPFS_PULL_PASSWORD@github.com|" Cargo.toml - - run: pipenv sync --dev - - name: Build - run: pipenv run -- cargo build --verbose - - name: Test - run: pipenv run -- cargo test --verbose --no-default-features diff --git a/.github/workflows/python.yml b/.github/workflows/test.yml similarity index 68% rename from .github/workflows/python.yml rename to .github/workflows/test.yml index 478e4fc923..f59a1ec416 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Python +name: Lint & Test on: pull_request: @@ -10,16 +10,28 @@ env: CARGO_TERM_COLOR: always jobs: - lint: + lint-python: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - run: sudo pip3 install pipenv - run: pipenv sync --dev - - name: Lint Formatting with Black - run: pipenv run -- black --check . - - name: Lint Typing with MyPy - run: pipenv run -- mypy spk + - name: Lint Python Code + run: make lint-python + lint-rust: + runs-on: ubuntu-latest + env: + SPFS_PULL_USERNAME: ${{ secrets.SPFS_PULL_USERNAME }} + SPFS_PULL_PASSWORD: ${{ secrets.SPFS_PULL_PASSWORD }} + steps: + - uses: actions/checkout@v2 + - name: Check Rust Formatting + run: cargo fmt -- --check + - run: sudo apt-get install -y libcap-dev + - name: Patch spfs Pull Auth + run: sed -i "s|github.com|$SPFS_PULL_USERNAME:$SPFS_PULL_PASSWORD@github.com|" Cargo.toml + - name: Lint Rust Code + run: make lint-rust test: runs-on: ubuntu-18.04 steps: @@ -48,6 +60,7 @@ jobs: -e SPFS_PULL_USERNAME -e SPFS_PULL_PASSWORD -e HOME=/root + -e CI --rm --privileged -v $PWD:/source diff --git a/Makefile b/Makefile index 179fbfbfbc..80dd3f5c1c 100644 --- a/Makefile +++ b/Makefile @@ -39,10 +39,7 @@ devel: .PHONY: test test-python test-rust test: test-rust test-python test-rust: - # other tooling (rust-analyzer) can create - # unhappy builds of pyo3 which cause the build of - # the tests to fail - cargo clean -p pyo3 && cargo test --no-default-features + spfs run - -- cargo test --no-default-features test-python: mkdir -p /tmp/spfs-runtimes SPFS_STORAGE_RUNTIMES="/tmp/spfs-runtimes" \ diff --git a/examples/_test.py b/examples/_test.py index 343edcd5cf..f506ac1691 100644 --- a/examples/_test.py +++ b/examples/_test.py @@ -44,6 +44,9 @@ def test_example(stage: str, spec_file: str) -> None: except FileNotFoundError: pytest.skip("examples depend on external packages") + if "CI" in os.environ: + pytest.skip("examples depend on external packages, and do not run in CI") + subprocess.check_call( [ os.path.dirname(sys.executable) + "/spk",