r2d2 dependecie fix #702
This file contains 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
# Based on: | |
# - https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml | |
# | |
# Using: | |
# - https://github.com/actions-rs/toolchain -> https://github.com/marketplace/actions/rust-toolchain | |
# - https://github.com/actions-rs/cargo -> https://github.com/marketplace/actions/rust-cargo | |
# | |
# TODO: | |
# - Run tests in arm little-endian architecture (travis-ci?) | |
# - Test cross compilation to many arch (E.g ripgrep) | |
# - cargo tarpaulin does not work on windows | |
# - cargo tarpaulin does not work on macos | |
# - cargo test fails with linking on macos | |
on: | |
push: | |
paths-ignore: | |
- ".github/workflows/**" | |
pull_request: | |
types: [opened, reopened, synchronize, ready_for_review, labeled] | |
name: testing_changes | |
jobs: | |
run-guard: | |
# other jobs depend on this one using 'needs: run-guard' to avoid running when it is skipped. | |
# it succeeds if any of the following conditions are met: | |
# - it is not a pr-labeling event AND the pr is not labeled 'prevent-ci' AND it is not a draft pr | |
# - it is not a pr-labeling event AND the pr is labeled 'force-ci' | |
# - it is a pr-labeling event AND the label being added is 'force-ci' | |
# | |
# on success it dumps the action's 'github' context | |
runs-on: ubuntu-latest | |
name: "run-guard" | |
if: | | |
( | |
(github.event.action != 'labeled') | |
&& !contains( github.event.pull_request.labels.*.name, 'prevent-ci') | |
&& !github.event.pull_request.draft | |
) | |
|| ( (github.event.action != 'labeled') && contains( github.event.pull_request.labels.*.name, 'force-ci' ) ) | |
|| (github.event.label.name == 'force-ci') | |
steps: | |
- name: continue | |
run: echo not skipping CI. continuing now... | |
linting: | |
name: linting | |
runs-on: ubuntu-latest | |
needs: run-guard | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: default | |
toolchain: stable | |
default: true | |
override: true | |
components: rustfmt, clippy | |
- name: Run cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
args: --verbose | |
- name: Run cargo clippy | |
uses: actions-rs/clippy-check@v1 | |
continue-on-error: true # show all errors | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
testing: | |
name: testing | |
needs: linting | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-20.04", "windows-latest", "macos-latest"] | |
firebird: [v3, v2, v4] | |
build: [linking, dynamic_loading, pure_rust] | |
exclude: | |
- os: "windows-latest" | |
firebird: v2 | |
- os: "windows-latest" | |
firebird: v3 | |
- os: "macos-latest" | |
firebird: v2 | |
- os: "macos-latest" | |
firebird: v4 | |
include: | |
- os: "ubuntu-20.04" | |
plataform: linux | |
- os: "windows-latest" | |
plataform: windows | |
- os: "macos-latest" | |
plataform: macos | |
- firebird: v2 | |
image: "2.5-ss" | |
- firebird: v3 | |
image: "3.0" | |
- firebird: v4 | |
image: "4.0" | |
- build: linking | |
features: linking | |
features_diesel: linking | |
- build: dynamic_loading | |
features: dynamic_loading | |
features_diesel: dynamic_loading | |
- build: pure_rust | |
features: pure_rust | |
features_diesel: pure_rust | |
runs-on: "${{ matrix.os }}" | |
steps: | |
- name: Setup FirebirdSQL ${{ matrix.firebird }} with image ${{ matrix.image }} on docker | |
if: matrix.plataform == 'linux' | |
uses: juarezr/[email protected] | |
with: | |
version: "${{ matrix.image }}" | |
firebird_database: "test.fdb" | |
firebird_user: "test_user" | |
firebird_password: "test_password" | |
isc_password: "masterkey" | |
- name: Setup FirebirdSQL ${{ matrix.firebird }} on Windows | |
if: matrix.plataform == 'windows' | |
run: | | |
choco install firebird -params '/SuperClassic' | |
- name: Setup FirebirdSQL ${{ matrix.firebird }} on MacOSX | |
if: matrix.plataform == 'macos' | |
shell: bash | |
run: | | |
wget https://github.com/FirebirdSQL/firebird/releases/download/R3_0_6/Firebird-3.0.6-33328-x86_64.pkg -O /tmp/firebird.pkg | |
sudo installer -verbose -pkg /tmp/firebird.pkg -target / | |
sudo ln -s /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libfbclient.dylib /usr/local/lib/libfbclient.dylib | |
- name: Locating fbclient.lib Dir on Windows | |
if: matrix.plataform == 'windows' | |
shell: powershell | |
run: | | |
function Search-Common-Folders() { | |
param ( | |
[string]$FileName | |
) | |
$WinSysDir = [Environment]::SystemDirectory | |
$CommonDirs = @( | |
"C:\Program Files\Firebird", | |
"C:\Firebird", | |
"${WinSysDir}" | |
) | |
Foreach ($folder in $CommonDirs) { | |
echo "# Finding relevant files in FirebirdSQL install:" | |
$found = Get-ChildItem -File -Recurse -Path $folder -Include $FileName -ea 0 | |
Foreach ($source in $found) { | |
echo " - $source" | |
} | |
} | |
} | |
Search-Common-Folders -FileName "fbclient.dll" | |
Search-Common-Folders -FileName "fbclient.lib" | |
Search-Common-Folders -FileName "fbclient_ms.lib" | |
Search-Common-Folders -FileName "isql.exe" | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Create a alias to test.fdb on fb v2 | |
if: matrix.firebird == 'v2' | |
run: | | |
docker exec firebirdsql /bin/bash '/usr/local/firebird/bin/createAliasDB.sh' 'test.fdb' '/firebird/data/test.fdb' | |
docker container restart firebirdsql | |
echo '# Restarted container firebirdsql' | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: default | |
toolchain: stable | |
default: true | |
- name: Install cli and development library on Linux | |
if: matrix.plataform == 'linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends firebird3.0-utils firebird-dev | |
- name: Create database test.fdb in fb ${{ matrix.firebird }} on Windows | |
if: matrix.plataform == 'windows' | |
run: | | |
echo "CREATE DATABASE 'localhost:test.fdb';" | & "C:\Program Files\Firebird\Firebird_4_0\isql.exe" -bail -quiet -z -user SYSDBA -password masterkey | |
- name: Create database test.fdb in fb ${{ matrix.firebird }} on MacOSX | |
if: matrix.plataform == 'macos' | |
run: | | |
echo "CREATE DATABASE 'localhost:test.fdb';" | /Library/Frameworks/Firebird.framework/Resources/bin/isql -bail -quiet -z -user SYSDBA -password masterkey | |
- name: Testing Connection and Query on Linux | |
if: matrix.firebird != 'v4' && matrix.plataform == 'linux' | |
run: | | |
SQL1='select RDB$CHARACTER_SET_NAME as charset_sysdba from rdb$database;' | |
echo $SQL1 | isql-fb -bail -quiet -z -user SYSDBA -password masterkey 'localhost:/firebird/data/test.fdb' | |
- name: Testing Connection for User test_user on fb v3 | |
if: matrix.firebird == 'v3' && matrix.plataform == 'linux' | |
run: | | |
SQL2='select RDB$CHARACTER_SET_NAME as charset_user from rdb$database;' | |
echo $SQL2 | isql-fb -bail -quiet -z -user test_user -password test_password 'localhost:test.fdb' | |
- name: Run cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: -v --no-default-features --features '${{ matrix.features }}' | |
# Searching for fbclient.lib in rsfbclient-native/build.rs | |
- name: Run cargo test on rsfbclient | |
uses: actions-rs/cargo@v1 | |
if: matrix.plataform != 'macos' || matrix.build != 'linking' | |
with: | |
command: test | |
args: --no-default-features --features '${{ matrix.features }}' -- --test-threads 1 | |
- name: Run cargo test on rsfbclient-rust | |
uses: actions-rs/cargo@v1 | |
if: matrix.plataform != 'macos' || matrix.build != 'linking' | |
with: | |
command: test | |
args: -p rsfbclient-rust | |
- name: Run cargo test on rsfbclient-diesel | |
uses: actions-rs/cargo@v1 | |
if: matrix.plataform != 'macos' || matrix.build != 'linking' | |
with: | |
command: test | |
args: --manifest-path rsfbclient-diesel/Cargo.toml --no-default-features --features '${{ matrix.features_diesel }}' -- --test-threads 1 | |
- name: Run cargo-tarpaulin on rsfbclient | |
uses: actions-rs/[email protected] | |
if: matrix.plataform == 'linux' | |
# TODO: #[error]The process 'C:\Rust\.cargo\bin\cargo.exe' failed with exit code 101: error: no such subcommand: `tarpaulin` | |
with: | |
version: "0.22.0" | |
run-types: "AllTargets" | |
out-type: "Lcov" | |
args: -v --line --count --branch --no-default-features --features '${{ matrix.features }}' -- --test-threads 1 | |
- name: Coveralls Parallel on rsfbclient | |
uses: coverallsapp/github-action@master | |
if: matrix.plataform == 'linux' | |
env: | |
COVERALLS_FLAG_NAME: run-${{ matrix.firebird }}-${{ matrix.build }}-rsfbclient | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: "./lcov.info" | |
parallel: true | |
# flag-name: run-${{ matrix.firebird }}-${{ matrix.build }} | |
- name: Run cargo-tarpaulin on rsfbclient-rust | |
uses: actions-rs/[email protected] | |
if: matrix.plataform == 'linux' | |
# TODO: #[error]The process 'C:\Rust\.cargo\bin\cargo.exe' failed with exit code 101: error: no such subcommand: `tarpaulin` | |
with: | |
version: "0.22.0" | |
run-types: "AllTargets" | |
out-type: "Lcov" | |
args: -v --line --count --branch -p rsfbclient-rust | |
- name: Coveralls Parallel on rsfbclient-rust | |
uses: coverallsapp/github-action@master | |
if: matrix.plataform == 'linux' | |
env: | |
COVERALLS_FLAG_NAME: run-${{ matrix.firebird }}-${{ matrix.build }}-rsfbclient-rust | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: "./lcov.info" | |
parallel: true | |
# flag-name: run-${{ matrix.firebird }}-${{ matrix.build }} | |
- name: Run cargo-tarpaulin on rsfbclient-diesel | |
uses: actions-rs/[email protected] | |
if: matrix.plataform == 'linux' | |
# TODO: #[error]The process 'C:\Rust\.cargo\bin\cargo.exe' failed with exit code 101: error: no such subcommand: `tarpaulin` | |
with: | |
version: "0.22.0" | |
run-types: "AllTargets" | |
out-type: "Lcov" | |
args: -v --line --count --branch --manifest-path rsfbclient-diesel/Cargo.toml --no-default-features --features '${{ matrix.features_diesel }}' -- --test-threads 1 | |
- name: Coveralls Parallel on rsfbclient-diesel | |
uses: coverallsapp/github-action@master | |
if: matrix.plataform == 'linux' | |
env: | |
COVERALLS_FLAG_NAME: run-${{ matrix.firebird }}-${{ matrix.build }}-rsfbclient-diesel | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: "./lcov.info" | |
parallel: true | |
# flag-name: run-${{ matrix.firebird }}-${{ matrix.build }} | |
- name: Cleanup docker and coverage | |
if: matrix.plataform == 'linux' | |
run: | | |
docker rm --volumes --force firebirdsql | |
rm -f ./lcov.info | |
coverage: | |
name: coverage | |
needs: testing | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true | |
embedded: | |
name: embedded | |
needs: linting | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
build: [linking, dynamic_loading] | |
include: | |
- build: linking | |
features: linking embedded_tests | |
- build: dynamic_loading | |
features: dynamic_loading embedded_tests | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: default | |
toolchain: stable | |
default: true | |
- name: Setup FirebirdSQL 3.0 for embedded tests | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends firebird3.0-utils firebird-dev firebird3.0-server-core | |
- name: Create database for embedded tests | |
run: | | |
echo 'create database "/tmp/embedded_tests.fdb";' | isql-fb -bail -quiet -user SYSDBA | |
- name: Run cargo embedded tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --no-default-features --features '${{ matrix.features }}' -- --test-threads 1 | |
security: | |
name: security | |
needs: linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Run security audit | |
uses: actions-rs/audit-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# end of file |