Skip to content

Run butane-core tests with async-adapter feature (#281) #678

Run butane-core tests with async-adapter feature (#281)

Run butane-core tests with async-adapter feature (#281) #678

Workflow file for this run

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
jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
- macos-12
- windows-2019
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 postgres on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y postgresql
sudo sed -i "s/scram-sha-256/trust/" /etc/postgresql/14/main/pg_hba.conf
sudo cat /etc/postgresql/14/main/pg_hba.conf
sudo service postgresql restart && sleep 3
echo BUTANE_PG_CONNSTR="host=localhost user=postgres sslmode=disable port=5432" >> $GITHUB_ENV
- name: Setup postgres on MacOS
if: runner.os == 'macOS'
run: |
initdb -D /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres start
sleep 3
createuser -s postgres
echo BUTANE_PG_CONNSTR="host=localhost user=postgres sslmode=disable port=5432" >> $GITHUB_ENV
- name: Install postgres (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
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 (x86)\Microsoft Visual Studio\2019\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,typos
- 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 Core
run: cd butane_core && cargo +stable test --all-features
- 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: cd butane && cargo +stable test --all-features
- name: Check example migrations have been updated
run: |
set -ex
make regenerate-example-migrations
git add -A
git diff --cached --exit-code
- name: Run tests in examples
run: |
cargo +stable test -p example --all-features
cd examples
for dir in *; do
cargo +stable test -p $dir --all-features
done