Skip to content

Merge pull request #92 from michalc/test/add-case-for-coverage #297

Merge pull request #92 from michalc/test/add-case-for-coverage

Merge pull request #92 from michalc/test/add-case-for-coverage #297

Workflow file for this run

name: Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
download-minio:
runs-on: ubuntu-latest
steps:
- name: "Download MinIO"
run: |
mkdir -p ./minio
curl -sS -L \
https://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2023-07-21T21-12-44Z -o ./minio/minio-linux \
https://dl.min.io/server/minio/release/darwin-amd64/archive/minio.RELEASE.2023-07-21T21-12-44Z -o ./minio/minio-darwin \
https://dl.min.io/server/minio/release/windows-amd64/archive/minio.RELEASE.2023-07-21T21-12-44Z -o ./minio/minio-windows.exe
- name: "Save MinIO"
uses: actions/upload-artifact@v3
with:
name: minio
path: ./minio/*
# We want older SQLite amalgamation files, but they are not available to download,
# so must be built from source. And they cannot be build on Windows, even for tests
# that then compile the amalgamation on Windows
create-sqlite-amalgamation:
name: "Create SQLite amalgamation"
runs-on: ubuntu-latest
strategy:
matrix:
sqlite-url-version:
- {version: "3042000", url: "https://www.sqlite.org/src/tarball/831d0fb2/SQLite-831d0fb2.tar.gz"}
- {version: "3036000", url: "https://www.sqlite.org/src/tarball/5c9a6c06/SQLite-5c9a6c06.tar.gz"}
- {version: "3007015", url: "https://www.sqlite.org/src/tarball/cd0b37c5/SQLite-cd0b37c5.tar.gz"}
steps:
- name: "Download SQLite source and build amalgamation"
run: |
curl -sS -L '${{ matrix.sqlite-url-version.url }}' -o sqlite3.tar.gz
mkdir sqlite3
tar -zxvf sqlite3.tar.gz --strip-components=1 -C sqlite3
cd sqlite3
./configure
make sqlite3.c
- name: "Save SQLite amalgamation"
uses: actions/upload-artifact@v3
with:
name: sqlite-${{ matrix.sqlite-url-version.version }}
path: ./sqlite3/sqlite3.c
test:
name: Test
needs: [download-minio, create-sqlite-amalgamation]
strategy:
matrix:
# If changing how many times tests are run, must also change in codecov.yml
# to ensure test coverage is reported only after all tests have finished
os:
- "macos-11"
- "ubuntu-20.04"
- "windows-2019"
sqlite-version:
- "3042000"
- "3036000"
- "3007015"
- "default"
python-version:
- "3.6.7"
- "3.7.1"
- "3.8.0"
- "3.9.0"
- "3.10.0"
- "3.11.0"
package-extras:
- "ci-earliest"
- "ci-latest"
exclude:
- python-version: "3.6.7"
package-extras: "ci-latest"
runs-on: '${{ matrix.os }}'
env:
SQLITE3_VERSION: ${{ matrix.sqlite-version }}
MINIO_ROOT_USER: AKIAIOSFODNN7EXAMPLE
MINIO_ROOT_PASSWORD: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
MINIO_REGION: us-east-1
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: '${{ matrix.python-version }}'
- name: "Load MinIO"
uses: actions/download-artifact@v3
with:
name: minio
path: ./minio
- name: "Load SQLite amalgamation"
if: matrix.sqlite-version != 'default'
uses: actions/download-artifact@v3
with:
name: sqlite-${{ matrix.sqlite-version }}
path: .
- name: "Compile SQLite from amalgamation (Windows)"
if: matrix.os == 'windows-2019' && matrix.sqlite-version != 'default'
run: |
gcc -shared sqlite3.c -o sqlite3.dll
echo "LIBSQLITE3_PATH=${PWD}/sqlite3.dll" >> $env:GITHUB_ENV
- name: "Compile SQLite from amalgamation (Ubuntu or macOS)"
if: (matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-11') && matrix.sqlite-version != 'default'
run: |
gcc -shared -fPIC -o libsqlite3.so.0 sqlite3.c
echo "LIBSQLITE3_PATH=${PWD}/libsqlite3.so.0" >> "$GITHUB_ENV"
- name: "Install sqlite-s3-query and any dependencies"
run: |
pip install ".[dev,${{ matrix.package-extras }}]"
- name: "Test (Windows)"
if: matrix.os == 'windows-2019'
run: |
mkdir -p ./data
./minio/minio-windows.exe server ./data &
do {
Write-Host "Waiting for MinIO"
sleep 3
} until(Test-NetConnection 127.0.0.1 -Port 9000 | ? { $_.TcpTestSucceeded } )
coverage run -m unittest
- name: "Test (Ubuntu)"
if: matrix.os == 'ubuntu-20.04'
run: |
mkdir -p ./data
chmod +x ./minio/minio-linux
./minio/minio-linux server ./data &
until nc -w 10 127.0.0.1 9000; do sleep 1; done
coverage run -m unittest
- name: "Test (macOS)"
if: matrix.os == 'macos-11'
run: |
mkdir -p ./data
chmod +x ./minio/minio-darwin
./minio/minio-darwin server ./data &
until nc -w 10 127.0.0.1 9000; do sleep 1; done
coverage run -m unittest
- uses: codecov/codecov-action@v3