Add libsql support #1063
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - actions-* | |
| pull_request: | |
| branches: | |
| - master | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| mise_tools: "ephemeral-postgres libsql-server" | |
| - os: macos-latest | |
| mise_tools: "ephemeral-postgres libsql-server" | |
| - os: windows-latest | |
| mise_tools: "libsql-server" | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Setup git checkout linefeeds on Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| git config --system core.autocrlf false | |
| git config --system core.eol lf | |
| - uses: actions/checkout@v4 | |
| # Postgresql setup adapted from Diesel CI | |
| # Disable ssl as server doesn't have a trusted cert | |
| - name: Setup PostgreSQL on Linux | |
| if: runner.os == 'Linux' | |
| run: | | |
| set -ex | |
| sudo apt-get update | |
| sudo apt-get install -y postgresql | |
| sudo sed -i "s/scram-sha-256/trust/" /etc/postgresql/16/main/pg_hba.conf | |
| sudo cat /etc/postgresql/16/main/pg_hba.conf | |
| sudo service postgresql restart && sleep 3 | |
| echo BUTANE_PG_CONNSTR="host=localhost user=postgres sslmode=disable port=5432" >> $GITHUB_ENV | |
| echo "/usr/lib/postgresql/16/bin" >> $GITHUB_PATH | |
| - name: Setup PostgreSQL on MacOS | |
| if: runner.os == 'macOS' | |
| run: | | |
| set -ex | |
| brew install postgresql | |
| brew services start postgresql@14 | |
| sleep 3 | |
| createuser -s postgres | |
| echo BUTANE_PG_CONNSTR="host=localhost user=postgres sslmode=disable port=5432" >> $GITHUB_ENV | |
| - name: Install PostgreSQL on Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| set -ex | |
| choco install postgresql12 --force --params '/Password:root' | |
| echo "C:\Program Files\PostgreSQL\12\bin" >> $GITHUB_PATH | |
| echo "C:\Program Files\PostgreSQL\12\lib" >> $GITHUB_PATH | |
| echo "PQ_LIB_DIR=C:\Program Files\PostgreSQL\12\lib" >> $GITHUB_ENV | |
| echo BUTANE_PG_CONNSTR="host=localhost user=postgres password=root sslmode=disable port=5432" >> $GITHUB_ENV | |
| - name: Install sqlite (Windows) | |
| if: runner.os == 'Windows' | |
| shell: cmd | |
| run: | | |
| choco install sqlite | |
| cd /D C:\ProgramData\chocolatey\lib\SQLite\tools | |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
| lib /machine:x64 /def:sqlite3.def /out:sqlite3.lib | |
| echo "C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_PATH | |
| echo "SQLITE3_LIB_DIR=C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_ENV | |
| - name: Add Rust nightly toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| components: rustfmt | |
| - name: Add Rust nightly toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| - name: Install tool binaries | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-deny,editorconfig-checker,mise,typos | |
| - name: Install ${{ matrix.mise_tools }} via mise | |
| if: matrix.mise_tools != '' | |
| run: | | |
| mise install ${{ matrix.mise_tools }} | |
| if [ "${{ runner.os }}" = "Windows" ]; then | |
| echo "$USERPROFILE\\.local\\share\\mise\\shims" >> $GITHUB_PATH | |
| else | |
| echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH | |
| fi | |
| - name: Run editorconfig-checker | |
| run: editorconfig-checker | |
| - name: Build | |
| run: make build | |
| - name: Lint | |
| run: make lint-ci | |
| - name: Run cargo-deny | |
| run: cargo deny check all | |
| - name: Test Butane test helper with ${{ matrix.mise_tools }} | |
| if: runner.os != 'Windows' | |
| run: | | |
| if [ -n "${{ matrix.mise_tools }}" ]; then | |
| mise exec ${{ matrix.mise_tools }} -- cargo +stable test -p butane_test_helper --all-features | |
| else | |
| cargo +stable test -p butane_test_helper --all-features | |
| fi | |
| - name: Test Butane test helper without mise tools on Windows | |
| if: runner.os == 'Windows' | |
| run: cargo +stable test -p butane_test_helper --features "pg,sqlite,sqlite-bundled,turso" | |
| - name: Test Core | |
| run: | | |
| if [ -n "${{ matrix.mise_tools }}" ]; then | |
| mise exec ${{ matrix.mise_tools }} -- cargo +stable test -p butane_core --all-features | |
| else | |
| cargo +stable test -p butane_core --all-features | |
| fi | |
| - name: Test Codegen | |
| run: cd butane_codegen && cargo +stable test --all-features | |
| - name: Test CLI | |
| run: cd butane_cli && cargo +stable test --all-features | |
| - name: Test | |
| run: | | |
| if [ -n "${{ matrix.mise_tools }}" ]; then | |
| mise exec ${{ matrix.mise_tools }} -- cargo +stable test -p butane --all-features | |
| else | |
| cargo +stable test -p butane --all-features | |
| fi | |
| - name: Check example migrations have been updated | |
| run: | | |
| set -ex | |
| make regenerate-example-migrations | |
| # TODO: This file is created by one of the tests on Windows | |
| rm -f butane_core/sqlite | |
| git add -A | |
| git diff --cached --exit-code | |
| - name: Run tests in examples | |
| run: | | |
| set -ex | |
| cargo +stable test -p example --all-features | |
| cd examples | |
| for dir in *; do | |
| if [ -n "${{ matrix.mise_tools }}" ]; then | |
| mise exec ${{ matrix.mise_tools }} -- cargo +stable test -p $dir --all-features | |
| else | |
| cargo +stable test -p $dir --all-features | |
| fi | |
| done |