Skip to content

Add outputs

Add outputs #13

name: Download and compile SQLite
on:
workflow_call:
outputs:
artifact_id:
description: "ID of the artifact containing prebuilt SQLite libraries"
value: ${{ jobs.merge_assets.outputs.artifact }}
push:
branches:
- v3
jobs:
download_sqlite:
runs-on: ubuntu-latest
name: Download SQLite sources
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache_build
with:
path: out/
key: sqlite-src-${{ hashFiles('tool/') }}
- uses: dart-lang/setup-dart@v1
if: steps.cache_build.outputs.cache-hit != 'true'
- name: Download sqlite3
if: steps.cache_build.outputs.cache-hit != 'true'
run: |
dart run tool/download_sqlite.dart
- name: Upload sqlite3 sources
uses: actions/upload-artifact@v4
with:
name: sqlite3-src
path: out/
if-no-files-found: error
retention-days: 1
build_sqlite:
needs: [download_sqlite]
strategy:
matrix:
# We only really need this for Ubuntu, but we recommend users run the same
# steps so we better make sure they work on all platforms.
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: Compile sqlite3
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache_build
with:
path: out/
key: sqlite-prebuilt-${{ runner.os }}-${{ hashFiles('tool/') }}
- name: Download sqlite3 sources
if: steps.cache_build.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: sqlite3-src
path: sqlite3-src
- uses: dart-lang/setup-dart@v1
if: steps.cache_build.outputs.cache-hit != 'true'
- name: Install cross-compiling GCC
shell: bash
if: runner.os == 'Linux' && steps.cache_build.outputs.cache-hit != 'true'
run: |
sudo apt install -y gcc-aarch64-linux-gnu gcc-riscv64-linux-gnu gcc-arm-linux-gnueabihf gcc-i686-linux-gnu
- name: Compile sqlite3
if: steps.cache_build.outputs.cache-hit != 'true'
run: |
dart run tool/compile_sqlite.dart
- name: Upload sqlite3 binaries
uses: actions/upload-artifact@v4
with:
name: sqlite3-libs-${{ runner.os }}
path: out/
if-no-files-found: error
retention-days: 1
build_sqlite_windows:
needs: [download_sqlite]
strategy:
matrix:
arch: [amd64, amd64_x86, amd64_arm64]
runs-on: windows-latest
name: Compile sqlite3 Windows
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache_build
with:
path: out/
key: sqlite-prebuilt-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('tool/') }}
- name: Download sqlite3 sources
if: steps.cache_build.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: sqlite3-src
path: sqlite3-src
- uses: dart-lang/setup-dart@v1
if: steps.cache_build.outputs.cache-hit != 'true'
- uses: ilammy/msvc-dev-cmd@v1
if: steps.cache_build.outputs.cache-hit != 'true'
with:
arch: ${{ matrix.arch }}
- name: Compile sqlite3
if: steps.cache_build.outputs.cache-hit != 'true'
run: |
dart run tool/compile_sqlite.dart ${{ matrix.arch }}
- name: Upload sqlite3 binaries
uses: actions/upload-artifact@v4
with:
name: sqlite3-libs-${{ runner.os }}-${{ matrix.arch }}
path: out/
if-no-files-found: error
retention-days: 1
merge_assets:
runs-on: ubuntu-latest
needs: [build_sqlite, build_sqlite_windows]
name: Merge prebuilt libraries into single directory
outputs:
artifact: ${{ steps.upload.outputs.artifact-id }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v5
with:
name: sqlite3-libs-${{ runner.os }}-${{ matrix.arch }}
path: out/
merge-multiple: true
pattern: sqlite3-libs-*
- run: ls -al out/
- name: Upload final binaries
uses: actions/upload-artifact@v4
id: upload
with:
name: sqlite3-precompiled
path: out/
if-no-files-found: error
retention-days: 1