Files
GoogleDriveManagement/.github/workflows/build.yml
2020-12-04 14:31:35 -05:00

168 lines
5.2 KiB
YAML

name: Build and test GAM
on:
push:
branches: [ master ]
schedule:
- cron: '37 22 * * *'
defaults:
run:
shell: bash
env:
BUILD_PYTHON_VERSION: "3.9.0"
MIN_PYTHON_VERSION: "3.9.0"
BUILD_OPENSSL_VERSION: "1.1.1h"
MIN_OPENSSL_VERSION: "1.1.1h"
PATCHELF_VERSION: "0.12"
PYINSTALLER_COMMIT: "61d846d46bdc8b6d926bb57ae05e6c9bb884a144"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-16.04
jid: 1
goal: "build"
gamos: "linux"
- os: ubuntu-18.04
jid: 2
goal: "build"
gamos: "linux"
- os: ubuntu-20.04
jid: 3
goal: "build"
gamos: "linux"
- os: macos-10.15
jid: 4
goal: "build"
gamos: "macos"
- os: ubuntu-20.04
goal: "test"
python: "3.6"
jid: 7
gamos: "linux"
- os: ubuntu-20.04
goal: "test"
python: "3.7"
jid: 8
gamos: "linux"
- os: ubuntu-20.04
goal: "test"
python: "3.8"
jid: 9
gamos: "linux"
steps:
- uses: actions/checkout@master
with:
persist-credentials: false
fetch-depth: 0
- name: Cache multiple paths
uses: actions/cache@v2
if: matrix.goal != 'test'
with:
path: |
~/python
~/ssl
key: ${{ matrix.os }}-${{ matrix.jid }}-20201204
- name: Set env variables
env:
GAMOS: ${{ matrix.gamos }}
PLATFORM: ${{ matrix.platform }}
GOAL: ${{ matrix.goal }}
JID: ${{ matrix.jid }}
run: |
echo "GAMOS=${GAMOS}" >> $GITHUB_ENV
echo "PLATFORM=${PLATFORM}" >> $GITHUB_ENV
echo "GOAL=${GOAL}" >> $GITHUB_ENV
echo "JID=${JID}" >> $GITHUB_ENV
- name: Use pre-compiled Python for testing old versions
if: matrix.goal == 'test'
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Set env variables for pre-compiled Python
if: matrix.goal == 'test'
run: |
cd src
export python=$(which python3)
export pip=$(which pip3)
export gam="${python} -m gam"
export gampath="$(readlink -e .)"
echo -e "python: $python\npip: $pip\ngam: $gam\ngampath: $gampath\n"
echo "python=${python}" >> $GITHUB_ENV
echo "pip=${pip}" >> $GITHUB_ENV
echo "gam=${gam}" >> $GITHUB_ENV
echo "gampath=${gampath}" >> $GITHUB_ENV
- name: Build and install Python, OpenSSL and PyInstaller
if: matrix.goal != 'test' && steps.cache-primes.outputs.cache-hit != 'true'
run: |
set +e
cd src
source travis/${GAMOS}-before-install.sh
echo "python=$python" >> $GITHUB_ENV
echo "pip=$pip" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo -e "Python: $python\nPip: $pip\nLD_LIB...: $LD_LIBRARY_PATH"
export url="https://codeload.github.com/pyinstaller/pyinstaller/tar.gz/${PYINSTALLER_COMMIT}"
echo "Downloading ${url}"
curl -o pyinstaller.tar.gz --compressed "${url}"
tar xf pyinstaller.tar.gz
mv "pyinstaller-${PYINSTALLER_COMMIT}" pyinstaller
cd pyinstaller/bootloader
if [ "${PLATFORM}" == "x86" ]; then
BITS="32"
else
BITS="64"
fi
$python ./waf all --target-arch=${BITS}bit
- name: Install pip requirements
run: |
set +e
cd src
$pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 $pip install -U
$pip install --upgrade -r requirements.txt
- name: Build GAM with PyInstaller
if: matrix.goal != 'test'
run: |
set +e
cd src
source travis/${GAMOS}-install.sh
echo "gampath=$gampath" >> $GITHUB_ENV
echo "gam=$gam" >> $GITHUB_ENV
echo -e "GAM: $gam\nGAMPATH: $gampath\n"
- name: Basic Tests all jobs
run: |
cd src
echo -e "python: $python\npip: $pip\ngam: $gam\ngampath: $gampath\n"
$python -m unittest discover --start-directory ./ --pattern "*_test.py" --buffer
touch "${gampath}/nobrowser.txt"
$gam version extended
$gam version | grep runner
- name: Basic Tests build jobs only
if: matrix.goal != 'test'
run: |
cd src
export vline=$($gam version | grep "Python ")
export python_line=($vline)
export this_python=${python_line[1]}
$python tools/a_atleast_b.py "${this_python}" "${MIN_PYTHON_VERSION}"
export vline=$($gam version extended | grep "OpenSSL ")
export openssl_line=($vline)
export this_openssl="${openssl_line[1]}"
$python tools/a_atleast_b.py "${this_openssl}" "${MIN_OPENSSL_VERSION}"