Skip to content

Commit 3658097

Browse files
authored
Merge pull request #56 from michalc/ci/separate-creation-of-sqlite-amalgamation
ci: separate build of amalgamation
2 parents 865d13f + 6ad5bc7 commit 3658097

File tree

1 file changed

+46
-21
lines changed

1 file changed

+46
-21
lines changed

.github/workflows/test.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches: [ "main" ]
77

88
jobs:
9-
download:
9+
download-coverage-reporter:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: "Download coverage reporter"
@@ -25,16 +25,43 @@ jobs:
2525
name: reporter
2626
path: ./reporter/cc-test-reporter
2727

28+
# We want older SQLite amalgamation files, but they are not available to download,
29+
# so must be built from source. And they cannot be build on Windows, even for tests
30+
# that then compile the amalgamation on Windows
31+
create-sqlite-amalgamation:
32+
name: "Create SQLite amalgamation"
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
sqlite-url-version:
37+
- {version: "3042000", url: "https://www.sqlite.org/src/tarball/831d0fb2/SQLite-831d0fb2.tar.gz"}
38+
- {version: "3036000", url: "https://www.sqlite.org/src/tarball/5c9a6c06/SQLite-5c9a6c06.tar.gz"}
39+
- {version: "3007015", url: "https://www.sqlite.org/src/tarball/cd0b37c5/SQLite-cd0b37c5.tar.gz"}
40+
steps:
41+
- name: "Download SQLite source and build amalgamation"
42+
run: |
43+
wget -O sqlite3.tar.gz '${{ matrix.sqlite-url-version.url }}'
44+
mkdir sqlite3
45+
tar -zxvf sqlite3.tar.gz --strip-components=1 -C sqlite3
46+
cd sqlite3
47+
./configure
48+
make sqlite3.c
49+
- name: "Save SQLite amalgamation"
50+
uses: actions/upload-artifact@v3
51+
with:
52+
name: sqlite-${{ matrix.sqlite-url-version.version }}
53+
path: ./sqlite3/sqlite3.c
54+
2855
test:
2956
name: Test
30-
needs: download
57+
needs: [download-coverage-reporter, create-sqlite-amalgamation]
3158
strategy:
3259
matrix:
33-
sqlite3-url-version:
34-
- {url: "https://www.sqlite.org/src/tarball/831d0fb2/SQLite-831d0fb2.tar.gz", version: "3042000"}
35-
- {url: "https://www.sqlite.org/src/tarball/5c9a6c06/SQLite-5c9a6c06.tar.gz", version: "3036000"}
36-
- {url: "https://www.sqlite.org/src/tarball/cd0b37c5/SQLite-cd0b37c5.tar.gz", version: "3007015"}
37-
- {url: "default", version: "default"}
60+
sqlite-version:
61+
- "3042000"
62+
- "3036000"
63+
- "3007015"
64+
- "default"
3865
os-and-python-version:
3966
- {os: "ubuntu-20.04", python: "3.6.7"}
4067
- {os: "ubuntu-20.04", python: "3.7.1"}
@@ -56,20 +83,18 @@ jobs:
5683
with:
5784
name: reporter
5885
path: ./reporter
59-
- name: Install SQLite
60-
if: matrix.sqlite3-url-version.version != 'default'
86+
- name: "Load SQLite amalgamation"
87+
if: matrix.sqlite-version != 'default'
88+
uses: actions/download-artifact@v3
89+
with:
90+
name: sqlite-${{ matrix.sqlite-version }}
91+
path: .
92+
- name: "Compile SQLite from amalgamation"
93+
if: matrix.sqlite-version != 'default'
6194
run: |
62-
wget -O sqlite3.tar.gz '${{ matrix.sqlite3-url-version.url }}'
63-
mkdir sqlite3
64-
tar -zxvf sqlite3.tar.gz --strip-components=1 -C sqlite3
65-
(
66-
cd sqlite3
67-
./configure
68-
make sqlite3.c
69-
gcc -shared -fPIC -o libsqlite3.so.0 sqlite3.c
70-
)
71-
echo "SQLITE3_VERSION=${{ matrix.sqlite3-url-version.version }}" >> "$GITHUB_ENV"
72-
echo "LIBSQLITE3_PATH=${PWD}/sqlite3/libsqlite3.so.0" >> "$GITHUB_ENV"
95+
gcc -shared -fPIC -o libsqlite3.so.0 sqlite3.c
96+
echo "SQLITE3_VERSION=${{ matrix.sqlite-version }}" >> "$GITHUB_ENV"
97+
echo "LIBSQLITE3_PATH=${PWD}/libsqlite3.so.0" >> "$GITHUB_ENV"
7398
- name: "Install sqlite-s3-query and any dependencies"
7499
run: |
75100
pip install ".[dev]"
@@ -78,7 +103,7 @@ jobs:
78103
coverage run -m unittest
79104
coverage xml
80105
chmod +x ./reporter/cc-test-reporter
81-
COVERAGE_FILE_NAME="./coverage/${{ matrix.os-and-python-version.python }}-${{ matrix.sqlite3-url-version.version }}.json"
106+
COVERAGE_FILE_NAME="./coverage/${{ matrix.os-and-python-version.python }}-${{ matrix.sqlite-version }}.json"
82107
./reporter/cc-test-reporter format-coverage --output "$COVERAGE_FILE_NAME"
83108
- name: "Save code coverage"
84109
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)