Skip to content

Fix support for dependency version clauses for certain Python dependencies in Docker images #755

Fix support for dependency version clauses for certain Python dependencies in Docker images

Fix support for dependency version clauses for certain Python dependencies in Docker images #755

# Test changes that have been pushed to the master and dev branches
name: Testing and Validation
# Controls when the action will run.
on:
push:
branches: [ master, dev, notreal ]
pull_request:
branches: [ master, dev, notreal ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Run unit tests on Python
test_unit_ubuntu_latest:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install python3-venv
run: sudo apt-get install -y python3-venv
timeout-minutes: 5
- name: Cache Python Venv
id: cache-python-venv
uses: actions/cache@v1
with:
path: dmod_venv
key: dmod-venv-dir-${{ hashFiles('python/**/_version.py', '**/requirements*.txt') }}
- name: Init Python Venv
if: steps.cache-python-venv.outputs.cache-hit != 'true'
run: |
python3 -m venv dmod_venv
. dmod_venv/bin/activate
pip install --upgrade pip
deactivate
./scripts/update_package.sh --venv dmod_venv --no-service-packages --dependencies
- name: Cache Package Checksums
id: cache-packages-md5
uses: actions/cache@v1
with:
path: package_md5s
key: package_md5s-${{ hashFiles('python/**/*') }}
- name: Update Individual Packages
id: update-individual-packages
run: |
[ ! -d package_md5s ] && mkdir package_md5s
set -e
for p in `./scripts/run_tests.sh --list-packages --service-packages --quiet`; do
_P_SIMPLE_NAME="`basename ${p}`"
_P_MD5_FILE="package_md5s/${_P_SIMPLE_NAME}.md5"
_P_EXPECTED_MD5="`find ${p} -type f -exec md5sum {} \; | sort -k 2 | md5sum`"
if [ -e ${p}/setup.py ]; then
if [ '${{ steps.cache-python-venv.outputs.cache-hit }}' = 'true' ]; then
if [ -e ${_P_MD5_FILE} ]; then
if [ "`cat ${_P_MD5_FILE}`" = "${_P_EXPECTED_MD5}" ]; then
echo "Package checksum file '${_P_MD5_FILE}' matches expected"
else
echo "Package checksum file '${_P_MD5_FILE}' contents do not match; updating"
./scripts/update_package.sh --venv dmod_venv ${p}
fi
else
echo "Creating package checksum file '${_P_MD5_FILE}'"
echo "${_P_EXPECTED_MD5}" > ${_P_MD5_FILE}
fi
else
echo "Creating package checksum file '${_P_MD5_FILE}'"
echo "${_P_EXPECTED_MD5}" > ${_P_MD5_FILE}
fi
fi
done
set +e
- name: Cache SSL Setup
id: cache-ssl-setup
uses: actions/cache@v1
with:
path: ssl
key: dmod-ssl-setup
# Set up the SSL directory
# TODO: use more project-generic choice for email address for generated certs
- name: Setup SSL
if: steps.cache-ssl-setup.outputs.cache-hit != 'true'
run: |
mkdir ssl
mkdir ssl/local
mkdir ssl/requestservice
mkdir ssl/requests
mkdir ssl/scheduler
./scripts/gen_cert.sh -d ssl/local -email robert.bartel@noaa.gov
cp -a ssl/local/*.pem ssl/requestservice/.
cp -a ssl/local/*.pem ssl/requests/.
cp -a ssl/local/*.pem ssl/scheduler/.
- name: Run Tests
run: ./scripts/run_tests.sh --venv dmod_venv -v -srv
timeout-minutes: 1