add android and ios build #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release sqlite-js | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| name: build${{ matrix.skip-test != true && ' and test' || ''}} for ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| name: isim | |
| skip-test: true | |
| make: PLATFORM=isim | |
| - os: macos-latest | |
| name: ios | |
| skip-test: true | |
| make: PLATFORM=ios | |
| - os: ubuntu-latest | |
| arch: arm64-v8a | |
| name: android | |
| skip-test: true | |
| make: | |
| PLATFORM=android | |
| CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang | |
| - os: ubuntu-latest | |
| arch: x86_64 | |
| name: android | |
| skip-test: true | |
| make: | |
| PLATFORM=android | |
| CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang | |
| - os: ubuntu-latest | |
| arch: x86_64 | |
| name: linux | |
| - os: LinuxARM64 | |
| arch: arm64 | |
| name: linux | |
| - os: macos-latest | |
| name: macos | |
| - os: windows-latest | |
| arch: x86_64 | |
| name: windows | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| MAKEFLAGS: -j 8 | |
| steps: | |
| - uses: actions/[email protected] | |
| - name: build sqlite-js | |
| run: make ${{ matrix.make && matrix.make || ''}} | |
| - name: windows install sqlite3 | |
| if: matrix.os == 'windows-latest' | |
| run: choco install sqlite -y | |
| - name: macos install sqlite3 without SQLITE_OMIT_LOAD_EXTENSION | |
| if: matrix.name == 'macos' | |
| run: brew link sqlite --force | |
| - name: test sqlite-js | |
| if: matrix.skip-test != true | |
| run: make test | |
| - uses: actions/[email protected] | |
| with: | |
| name: js-${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} | |
| path: dist/js.* | |
| if-no-files-found: error | |
| release: | |
| runs-on: ubuntu-latest | |
| name: release | |
| needs: build | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: actions/[email protected] | |
| with: | |
| path: artifacts | |
| - name: release tag version from sqlitejs.h | |
| id: tag | |
| run: | | |
| FILE="src/sqlitejs.h" | |
| VERSION=$(grep -oP '#define SQLITE_JS_VERSION\s+"\K[^"]+' "$FILE") | |
| if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| echo "❌ SQLITE_JS_VERSION not found in sqlitejs.h" | |
| exit 1 | |
| - name: zip artifacts | |
| run: | | |
| for folder in "artifacts"/*; do | |
| if [ -d "$folder" ]; then | |
| name=$(basename "$folder") | |
| zip -jq "${name}-${{ steps.tag.outputs.version }}.zip" "$folder"/* | |
| tar -cJf "${name}-${{ steps.tag.outputs.version }}.tar.xz" -C "$folder" . | |
| tar -czf "${name}-${{ steps.tag.outputs.version }}.tar.gz" -C "$folder" . | |
| fi | |
| done | |
| - uses: softprops/[email protected] | |
| with: | |
| generate_release_notes: true | |
| tag_name: ${{ steps.tag.outputs.version }} | |
| files: | | |
| js-*-${{ steps.tag.outputs.version }}.zip | |
| js-*-${{ steps.tag.outputs.version }}.tar.xz | |
| js-*-${{ steps.tag.outputs.version }}.tar.gz | |
| make_latest: true |