Skip to content

Change Error (breaking change) #50

Change Error (breaking change)

Change Error (breaking change) #50

Workflow file for this run

name: Run tests
on: [push, pull_request]
jobs:
msrv:
runs-on: ubuntu-latest
outputs:
msrv: ${{ steps.msrv.outputs.msrv }}
rust_toolchains: ${{ steps.msrv.outputs.rust_toolchains }}
steps:
- uses: actions/checkout@v4
- id: msrv
name: Get minimum supported rust version in Cargo.toml
run: |
MSRV=$(sed -n -e 's/rust-version *= *"\(.*\)"/\1/p' Cargo.toml)
echo "rust_toolchains=[\"stable\", \"$MSRV\"]" >> $GITHUB_OUTPUT
tests:
needs: msrv
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust_toolchain: ${{ fromJSON(needs.msrv.outputs.rust_toolchains) }}
runs-on: ${{ matrix.os }}
env:
rust_features: aq_unstable,chrono
services:
oracle:
image: gvenzl/oracle-xe:latest
env:
ORACLE_PASSWORD: sys_passwd
ports:
- 1521:1521
options: >-
--health-cmd healthcheck.sh
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Wine
run: |
sudo apt-get update -q -y
sudo apt-get install -y g++-mingw-w64-x86-64 g++-mingw-w64-i686 wine wine-binfmt
sudo update-binfmts --unimport cli || true
- name: Install the latest Oracle instant client
run: |
curl -Lo basic.zip https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip
curl -Lo sqlplus.zip https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linuxx64.zip
curl -Lo basic-windows.zip https://download.oracle.com/otn_software/nt/instantclient/instantclient-basic-windows.zip
mkdir linux
unzip basic.zip -d linux
unzip sqlplus.zip -d linux
IC_DIR=$PWD/$(ls -d linux/instantclient*)
mkdir windows
unzip basic-windows.zip -d windows
WINEPATH=$PWD/$(ls -d windows/instantclient*)
echo LD_LIBRARY_PATH=$IC_DIR:$LD_LIBRARY_PATH >> $GITHUB_ENV
echo WINEPATH=$WINEPATH >> $GITHUB_ENV
echo $IC_DIR >> $GITHUB_PATH
- name: Get the Oracle container IP address
env:
ORACLE_SERVICE_ID: ${{ job.services.oracle.id }}
run: |
ORACLE_IP_ADDRESS=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{println .IPAddress}}{{end}}' $ORACLE_SERVICE_ID)
if test -z "$ORACLE_IP_ADDRESS"; then
echo "Cannot get ORACLE_IP_ADDRESS."
docker inspect $ORACLE_SERVICE_ID
exit 1
fi
echo TWO_TASK=//$ORACLE_IP_ADDRESS:1521/XEPDB1 >> $GITHUB_ENV
echo ODPIC_TEST_CONNECT_STRING=//$ORACLE_IP_ADDRESS:1521/XEPDB1 >> $GITHUB_ENV
echo NLS_LANG=AMERICAN_AMERICA.AL32UTF8 >> $GITHUB_ENV
- name: install rust
run: |
rustup install ${{ matrix.rust_toolchain }}
rustup target add x86_64-pc-windows-gnu --toolchain ${{ matrix.rust_toolchain }}
- name: Downgrade chrono to 0.4.31, whose MSRV is 1.57.0, if the rust toolchain isn't stable
if: matrix.rust_toolchain != 'stable'
run: |
cargo update -p chrono --precise 0.4.31
- name: Create Oracle users and schema
run: |
sqlplus sys/sys_passwd as sysdba @tests/SetupTest.sql < /dev/null
- name: cargo test (x86_64-unknown-linux-gnu)
run: |
rustup run ${{ matrix.rust_toolchain }} cargo test --features ${{ env.rust_features }} -- --nocapture
- name: cargo test (x86_64-pc-windows-gnu)
run: |
rustup run ${{ matrix.rust_toolchain }} cargo test --target x86_64-pc-windows-gnu --features ${{ env.rust_features }} -- --nocapture