Skip to content

Check cargo fmt in CI #16

Check cargo fmt in CI

Check cargo fmt in CI #16

Workflow file for this run

name: CI
on:
push:
branches:
- master
- actions-*
pull_request:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-2019
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
# 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: Install Rust tools
run: cargo install typos-cli
- name: Build
run: make build
- name: Lint
run: make lint-ci
- name: Test Core
run: cd butane_core && cargo test --all-features
- name: Test Codegen
run: cd butane_codegen && cargo test --all-features
- name: Test CLI
run: cd butane_cli && cargo test --all-features
- name: Run example cli tests
run: cd example && cargo test --all-features
- name: Test
run: cd butane && cargo test --all-features