I started by adding a service to the test step, using the same Docker image and passing the env vars the test used.
name: Tests
runs-on: ubuntu-latest
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
MSSQL_SA_PASSWORD: yourStrongPassword1
ACCEPT_EULA: "Y"
ports:
- 1433:1433
steps: - name: Checkout code
uses: actions/checkout@v3
....
The test step was already installing FreeTDS, which TinyTDS depends on. When I originally set it up, all the documentation I found pointed me toward getting the source and building and installing it. I followed advice in documentation and ended up installing it like this:
- name: Install freetds
run: |
sudo apt-get install -y build-essential wget \
&& wget http://www.freetds.org/files/stable/freetds-1.1.24.tar.gz \
&& tar -xzf freetds-1.1.24.tar.gz \
&& cd freetds-1.1.24 \
&& ./configure --prefix=/usr/local --with-tdsver=7.3 \
&& sudo make \
&& sudo make install
Now when I ran specs on CI, I got an error saying that the connection failed. I first confirmed the host and port I was using to connect to the local service. When I changed either of these, I got a new error message saying that the database server could not be found, so I was confident the host and port were correct. After a bunch of googling, I found a related GitHub issue which points to a problem with the TLS handshake on FreeTDS. This comment suggested using GnuTLS instead of OpenSSL for FreeTDS. I added a step to install GnuTLS in the GitHub workflow for running tests:
- name: Install gnutls
run: |
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.16.tar.xz \
&& tar -xf gnutls-3.6.16.tar.xz \
&& cd gnutls-3.6.16 \
&& ./configure --prefix=/usr/local \
&& sudo make \
&& sudo make install
This failed because it needed Libnettle 3.4.1. So I added a step to install nettle:
- name: Install nettle
run: |
wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz \
&& tar -xzf nettle-3.4.1.tar.gz \
&& cd nettle-3.4.1 \
&& ./configure --prefix=/usr/local --disable-openssl --enable-shared \
&& sudo make \
&& sudo make install
Nettle installed successfully, but I still got the error Libnettle 3.4.1 was not found.
when installing GnuTLS. At this point, I had exhausted my limited
understanding of package management on unix and reached out for help.
Mike jumped in to help and
noted that the FreeTDS package on Debian stable is version 1.3.17, and it uses
GnuTLS by default. This means that I could replace all the messy wget/tar/make
attempts with calls to apt-get:
- name: Install gnutls
run: |
sudo apt-get install gnutls-bin
- name: Install freetds
run: |
sudo apt-get install -y freetds-bin freetds-common freetds-dev libct4 libsybdb5