diff --git a/.github/workflows/python_build.yml b/.github/workflows/python_build.yml index 07126e3309..9ba98a2cef 100644 --- a/.github/workflows/python_build.yml +++ b/.github/workflows/python_build.yml @@ -2,7 +2,7 @@ name: python_build on: push: - branches: [ main ] + branches: [ main, qp_python ] pull_request: branches: [ main ] @@ -11,45 +11,18 @@ defaults: working-directory: ./python jobs: - build: + lint: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - # the whole target dir is over 400MB cache limit, so we have to split up - # the cache step to avoid caching deps dir - - name: Cache Rust build - uses: actions/cache@v1.0.1 - with: - path: target/debug/build - key: python-${{ runner.OS }}-target-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - python-${{ runner.OS }}-target-build- - - name: Cache Rust incremental build - uses: actions/cache@v1.0.1 - with: - path: target/debug/incremental - key: python-${{ runner.OS }}-target-incremental-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - python-${{ runner.OS }}-target-incremental- - - - name: Format Python code with Black + - name: Setup Python uses: actions/setup-python@v2 with: python-version: 3.6 - - - uses: psf/black@stable + - name: Format Python code with Black + uses: psf/black@stable with: - black_args: ". --check" - - - name: Setup virtualenv - run: | - pip install virtualenv - virtualenv venv - - - name: 'Install Python devel headers' - run: sudo apt install -y python3-dev - + args: ". --check" - name: Install minimal stable with clippy and rustfmt uses: actions-rs/toolchain@v1 with: @@ -58,18 +31,37 @@ jobs: override: true - name: Check run: cargo clippy - - name: Build - run: cargo build - # - name: Run Rust tests - # run: cargo test + - name: Format + run: cargo fmt -- --check - - name: Install matruin + test: + runs-on: ubuntu-latest + # use the same environment we have for python release + container: quay.io/pypa/manylinux2010_x86_64:2020-12-31-4928808 + steps: + # actions/checkout@v2 is a node action, which runs on a fairly new + # version of node. however, manylinux environment's glibc is too old for + # that version of the node. so we will have to use v1 instead, which is a + # docker based action. + - uses: actions/checkout@v1 + + # actions-rs/toolchain@v1 is a node action, which runs on a fairly new + # version of node. however, manylinux environment's glibc is too old for + # that version of the node. so we will have to install rust manually here. + - name: Install Rust run: | - pip install maturin==0.9.0 + curl https://sh.rustup.rs -sSf | sh -s -- -y + $HOME/.cargo/bin/rustup default stable + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Enable manylinux Python targets + run: echo "/opt/python/cp36-cp36m/bin" >> $GITHUB_PATH + + - name: Install matruin + run: pip install maturin==0.9.0 - name: Run Python tests run: | - source venv/bin/activate # disable manylinux audit checks for test builds maturin build --manylinux off ls -lh ../target/wheels diff --git a/rust/src/storage/file/rename.rs b/rust/src/storage/file/rename.rs index 037d04ce2b..94cb2eb378 100644 --- a/rust/src/storage/file/rename.rs +++ b/rust/src/storage/file/rename.rs @@ -39,11 +39,9 @@ mod imp { } pub fn atomic_rename(from: &str, to: &str) -> Result<(), StorageError> { - let ret = unsafe { - let from = to_c_string(from)?; - let to = to_c_string(to)?; - platform_specific_rename(from.as_ptr(), to.as_ptr()) - }; + let cs_from = to_c_string(from)?; + let cs_to = to_c_string(to)?; + let ret = unsafe { platform_specific_rename(cs_from.as_ptr(), cs_to.as_ptr()) }; if ret != 0 { let e = errno::errno();