diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 773954d..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,84 +0,0 @@ -version: 2.1 - -jobs: - download-test-reporter: - docker: - - image: cimg/base:2021.04 - steps: - - attach_workspace: - at: ~/workspace - - run: - name: Download test reporter - command: | - set -exu - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - - persist_to_workspace: - root: ./ - paths: - - cc-test-reporter - test: - parameters: - python-version: - type: string - docker: - - image: cimg/python:<< parameters.python-version >> - - image: minio/minio:RELEASE.2021-08-05T22-01-19Z - environment: - MINIO_ACCESS_KEY: AKIAIDIDIDIDIDIDIDID - MINIO_SECRET_KEY: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - MINIO_REGION: us-east-1 - entrypoint: sh - command: ['-c', 'mkdir -p /data1 && mkdir -p /data2 && mkdir -p /data3 && mkdir -p /data4 && minio server /data{1...4}'] - steps: - - checkout - - attach_workspace: - at: ~/workspace - - run: - name: Install dependencies - command: | - pip install -r requirements-dev.txt - pip install https://github.com/rogerbinns/apsw/releases/download/3.36.0-r1/apsw-3.36.0-r1.zip --global-option=fetch --global-option=--version --global-option=3.36.0 --global-option=--sqlite --global-option=build --global-option=--enable-all-extensions - - run: - name: Run tests - no_output_timeout: 30m - command: | - set -exu - ~/workspace/cc-test-reporter before-build - coverage run -m pytest - coverage xml - ~/workspace/cc-test-reporter format-coverage --output coverage/<< parameters.python-version >>.json - - persist_to_workspace: - root: ./ - paths: - - coverage/*.json - upload-coverage: - docker: - - image: cimg/base:2021.04 - steps: - - attach_workspace: - at: ~/workspace - - run: - name: Upload coverage - command: | - set -exu - ~/workspace/cc-test-reporter sum-coverage ~/workspace/coverage/*.json -p 3 - ~/workspace/cc-test-reporter upload-coverage - -workflows: - test: - jobs: - - download-test-reporter - - test: - requires: - - download-test-reporter - matrix: - parameters: - python-version: - - "3.7.11" - - "3.8.12" - - "3.9.7" - - - upload-coverage: - requires: - - test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9dd56da --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + test: + name: Test + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: + - "3.7.13" + - "3.8.12" + - "3.9.12" + steps: + - name: "Checkout" + uses: "actions/checkout@v3" + - uses: "actions/setup-python@v4" + with: + python-version: '${{ matrix.python-version }}' + - name: "Start MinIO" + run: ./start-minio.sh + - name: "Install package and python dependencies" + run: | + pip install .[dev] + pip install https://github.com/rogerbinns/apsw/releases/download/3.36.0-r1/apsw-3.36.0-r1.zip --global-option=fetch --global-option=--version --global-option=3.36.0 --global-option=--sqlite --global-option=build --global-option=--enable-all-extensions + - name: "Test" + run: | + pytest --cov + - uses: codecov/codecov-action@v3 diff --git a/README.md b/README.md index 56fb5db..d6a71ea 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# sqlite-s3vfs [![CircleCI](https://circleci.com/gh/uktrade/sqlite-s3vfs.svg?style=shield)](https://circleci.com/gh/uktrade/sqlite-s3vfs) [![Test Coverage](https://api.codeclimate.com/v1/badges/6df8a84b0ff21d7ecf22/test_coverage)](https://codeclimate.com/github/uktrade/sqlite-s3vfs/test_coverage) +# sqlite-s3vfs + +[![PyPI package](https://img.shields.io/pypi/v/sqlite-s3vfs?label=PyPI%20package&color=%234c1)](https://pypi.org/project/sqlite-s3vfs/) [![Test suite](https://img.shields.io/github/actions/workflow/status/uktrade/sqlite-s3vfs/test.yml?label=Test%20suite)](https://github.com/uktrade/sqlite-s3vfs/actions/workflows/test.yml) [![Code coverage](https://img.shields.io/codecov/c/github/uktrade/sqlite-s3vfs?label=Code%20coverage)](https://app.codecov.io/gh/uktrade/sqlite-s3vfs) Python virtual filesystem for SQLite to read from and write to S3. diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 0000000..69cb760 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1 @@ +comment: false diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..59d3f29 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,35 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "sqlite-s3vfs" +version = "0.0.0.dev0" +authors = [ + { name="Department for International Trade", email="sre@digital.trade.gov.uk" }, +] +description = "Virtual filesystem for SQLite to read from and write to S3" +readme = "README.md" +requires-python = ">=3.7.11" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Topic :: Database", +] +dependencies = [ + "boto3>=1.18.51", +] + +[project.optional-dependencies] +dev = [ + "pytest>=6.2.5", + "pytest-cov>=3.0.0", +] + +[project.urls] +"Homepage" = "https://github.com/uktrade/sqlite-s3vfs" + +[tool.hatch.build] +include = [ + "sqlite_s3vfs.py", +] diff --git a/start-minio.sh b/start-minio.sh index 54e6908..db65be0 100755 --- a/start-minio.sh +++ b/start-minio.sh @@ -15,3 +15,5 @@ docker run --rm -p 9000:9000 --name sqlite-s3vfs-minio -d \ mkdir -p /data4 && minio server /data{1...4} ' + +timeout 60 bash -c 'until echo > /dev/tcp/127.0.0.1/9000; do sleep 5; done'