Skip to content

Use Ubuntu 22 for unit test workflow (#1011) #570

Use Ubuntu 22 for unit test workflow (#1011)

Use Ubuntu 22 for unit test workflow (#1011) #570

Workflow file for this run

name: ERMrestJS tests
on: [push]
jobs:
install-and-test:
runs-on: ubuntu-22.04
env:
PYTHONWARNINGS: ignore:Unverified HTTPS request
timeout-minutes: 15
steps:
- name: Checkout repository code
uses: actions/checkout@v4
with:
path: ermrestjs
- name: Setup the system
run: |
whoami
echo "npm version:"
npm --version
echo "node version:"
node --version
sudo timedatectl set-timezone America/Los_Angeles
export PATH="$(systemd-path user-binaries):$PATH"
sudo apt-get -y update
sudo apt-get -y install libcurl4-openssl-dev libjson-c-dev
sudo service postgresql stop || true
sudo service postgresql start 12
sudo apt-get install apache2 apache2-dev ssl-cert libapache2-mod-wsgi-py3
sudo ln -s /etc/apache2/conf-enabled /etc/apache2/conf.d
sudo a2enmod ssl
sudo a2ensite default-ssl
sudo groupadd -o -g $(id -g www-data) apache
sudo apt-get install -y python3-setuptools python3-ply
sudo python3 --version
sudo pip3 --version
sudo su -c 'echo /usr/lib/python3.10/site-packages > /usr/local/lib/python3.10/dist-packages/sys-site-packages.pth'
sudo su -c 'python3 -c "import site;print(site.PREFIXES);"'
sudo su -c 'python3 -c "import site;print(site.getsitepackages())"'
: # the line below will make sure pyopenssl and cryptography have compatible versions
sudo pip3 install -U pyopenssl cryptography
sudo pip3 install flask
sudo pip3 install requests
sudo pip3 install globus_sdk
sudo pip3 install psycopg2-binary
sudo pip3 install oauth2client
- name: Install webauthn
run: |
sudo useradd -m -r webauthn
sudo su -c '/usr/bin/python3 -c "import sys;import pprint;pprint.pprint(sys.path)"' - webauthn
git clone https://github.com/informatics-isi-edu/webauthn.git
cd webauthn
sudo make testvars
sudo make install
sudo make deploy
sudo bash ./test/ubuntu-travis-setup.sh
sudo a2enmod webauthn
sudo service apache2 restart
- name: Install hatrac
run: |
git clone https://github.com/informatics-isi-edu/hatrac.git
cd hatrac
sudo python3 ./setup.py install
sudo useradd -m -r hatrac
sudo -H -u postgres createuser -d hatrac
sudo -H -u postgres psql -c "GRANT webauthn TO hatrac"
sudo -H -u hatrac createdb hatrac
sudo cp test/hatrac_config.json ~hatrac/
sudo -H -u hatrac hatrac-deploy admin
sudo su -c 'python3 -c "import hatrac as m;m.sample_httpd_config()"' - hatrac > ../wsgi_hatrac.conf
sudo cp ../wsgi_hatrac.conf /etc/apache2/conf.d/wsgi_hatrac.conf
sudo mkdir /var/www/hatrac
sudo chown hatrac /var/www/hatrac
- name: Install ermrest
run: |
git clone https://github.com/informatics-isi-edu/ermrest.git
cd ermrest
sudo -H make install PLATFORM=ubuntu1604
sudo which ermrest-deploy
sudo -H make deploy PLATFORM=ubuntu1604
cd ../ermrestjs
sudo cp test/ermrest_config.json /home/ermrest/
sudo chmod a+r /home/ermrest/ermrest_config.json
- name: Install ermrestjs
run: |
cd ermrestjs
sudo make root-install
- name: Add tests users
run: |
sudo -H -u webauthn webauthn2-manage adduser test1
sudo -H -u webauthn webauthn2-manage passwd test1 dummypassword
sudo -H -u webauthn webauthn2-manage addattr admin
sudo -H -u webauthn webauthn2-manage assign test1 admin
sudo -H -u webauthn webauthn2-manage adduser test2
sudo -H -u webauthn webauthn2-manage passwd test2 dummypassword
- name: Restart apache
run: |
sudo service apache2 restart
- name: Run test cases
id: unit-test
run: |
cd ermrestjs
make test
- name: Diagnosis after failure
if: ${{ failure() }}
run: |
echo "/etc/apache2 folder:"
sudo ls -lR /etc/apache2
echo "/var/run/apache2 folder:"
sudo ls -lR /var/run/apache2
echo "webauthn config"
sudo cat /etc/apache2/conf.d/webauthn.conf
echo "webauthn wsgi config"
sudo cat /etc/apache2/conf.d/wsgi_webauthn2.conf
echo "ermrest wsgi config"
sudo cat /etc/apache2/conf.d/wsgi_ermrest.conf
echo "apache error log:"
sudo cat /var/log/apache2/error.log
echo "apache access log:"
sudo cat /var/log/apache2/access.log
echo "sessions:"
sudo -H -u webauthn psql -c 'select * from webauthn2_db.session' webauthn