mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-19 05:31:37 +00:00
354 lines
16 KiB
YAML
354 lines
16 KiB
YAML
name: Build and test GAM
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
schedule:
|
|
- cron: '37 22 * * *'
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: src
|
|
|
|
env:
|
|
BUILD_PYTHON_VERSION: "3.9.5"
|
|
MIN_PYTHON_VERSION: "3.9.5"
|
|
BUILD_OPENSSL_VERSION: "1.1.1k"
|
|
MIN_OPENSSL_VERSION: "1.1.1k"
|
|
PATCHELF_VERSION: "0.12"
|
|
# PYINSTALLER_VERSION can be full commit hash or version like v4.20
|
|
PYINSTALLER_VERSION: "416f42b548b513fc29219eb7b4210751938b8603"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-16.04
|
|
jid: 1
|
|
goal: "build"
|
|
gamos: "linux"
|
|
platform: "x86_64"
|
|
- os: ubuntu-18.04
|
|
jid: 2
|
|
goal: "build"
|
|
gamos: "linux"
|
|
platform: "x86_64"
|
|
- os: ubuntu-20.04
|
|
jid: 3
|
|
goal: "build"
|
|
gamos: "linux"
|
|
platform: "x86_64"
|
|
- os: macos-10.15
|
|
jid: 4
|
|
goal: "build"
|
|
gamos: "macos"
|
|
platform: "x86_64"
|
|
- os: macos-11.0
|
|
jid: 12
|
|
goal: "build"
|
|
gamos: "macos"
|
|
platform: "universal2"
|
|
- os: windows-2019
|
|
jid: 5
|
|
goal: "build"
|
|
gamos: "windows"
|
|
python: 3.9.5
|
|
pyarch: "x64"
|
|
platform: "x86_64"
|
|
- os: windows-2019
|
|
jid: 6
|
|
goal: "build"
|
|
gamos: "windows"
|
|
platform: "x86"
|
|
python: 3.9.5
|
|
pyarch: "x86"
|
|
- os: ubuntu-20.04
|
|
goal: "test"
|
|
python: "3.6"
|
|
jid: 7
|
|
gamos: "linux"
|
|
platform: "x86_64"
|
|
- os: ubuntu-20.04
|
|
goal: "test"
|
|
python: "3.7"
|
|
jid: 8
|
|
gamos: "linux"
|
|
platform: "x86_64"
|
|
- os: ubuntu-20.04
|
|
goal: "test"
|
|
python: "3.8"
|
|
jid: 9
|
|
gamos: "linux"
|
|
platform: "x86_64"
|
|
- os: ubuntu-20.04
|
|
goal: test
|
|
python: "3.10.0-beta.1"
|
|
jid: 10
|
|
gamos: linux
|
|
platform: x86_64
|
|
|
|
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 }}-20210511
|
|
|
|
- name: Set env variables
|
|
env:
|
|
GAMOS: ${{ matrix.gamos }}
|
|
GOAL: ${{ matrix.goal }}
|
|
JID: ${{ matrix.jid }}
|
|
PLATFORM: ${{ matrix.platform }}
|
|
run: |
|
|
echo "GAMOS=${GAMOS}" >> $GITHUB_ENV
|
|
echo "GOAL=${GOAL}" >> $GITHUB_ENV
|
|
echo "JID=${JID}" >> $GITHUB_ENV
|
|
echo "PLATFORM=${PLATFORM}" >> $GITHUB_ENV
|
|
uname -a
|
|
|
|
- name: Use pre-compiled Python for testing and Windows
|
|
if: matrix.python != ''
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
architecture: ${{ matrix.pyarch }}
|
|
|
|
- name: Set env variables for pre-compiled Python
|
|
if: matrix.goal == 'test'
|
|
run: |
|
|
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"
|
|
echo "python=${python}" >> $GITHUB_ENV
|
|
echo "pip=${pip}" >> $GITHUB_ENV
|
|
echo "gam=${gam}" >> $GITHUB_ENV
|
|
echo "gampath=${gampath}" >> $GITHUB_ENV
|
|
echo "RUNNING: apt update..."
|
|
sudo apt-get -qq --yes update > /dev/null
|
|
sudo apt-get -qq --yes install swig libpcsclite-dev
|
|
|
|
- name: Build and install Python, OpenSSL and PyInstaller
|
|
if: matrix.goal != 'test' && steps.cache-primes.outputs.cache-hit != 'true'
|
|
run: |
|
|
set +e
|
|
source ../.github/actions/${GAMOS}-before-install.sh
|
|
echo "PATH=$PATH" >> $GITHUB_ENV # keep gnutools for MacOS
|
|
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"
|
|
$pip install wheel
|
|
export url="https://codeload.github.com/pyinstaller/pyinstaller/tar.gz/${PYINSTALLER_VERSION}"
|
|
echo "Downloading ${url}"
|
|
curl -o pyinstaller.tar.gz --compressed "${url}"
|
|
tar xf pyinstaller.tar.gz
|
|
cd "pyinstaller-${PYINSTALLER_VERSION}/bootloader"
|
|
if [ "${PLATFORM}" == "x86" ]; then
|
|
TARGETARCH="--target-arch=32bit"
|
|
else
|
|
TARGETARCH=""
|
|
fi
|
|
#$python ./waf all $TARGETARCH
|
|
cd ..
|
|
$python setup.py install
|
|
#$pip install pyinstaller
|
|
|
|
- name: Install pip requirements
|
|
if: matrix.os != 'self-hosted'
|
|
run: |
|
|
set +e
|
|
$pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 $pip install -U --force-reinstall
|
|
|
|
$pip install --upgrade -r requirements.txt
|
|
|
|
- name: Build GAM with PyInstaller
|
|
if: matrix.goal != 'test'
|
|
run: |
|
|
set +e
|
|
source ../.github/actions/${GAMOS}-install.sh
|
|
ls -alRF $gampath
|
|
echo "gampath=$gampath" >> $GITHUB_ENV
|
|
echo "gam=$gam" >> $GITHUB_ENV
|
|
echo -e "GAM: ${gam}\nGAMPATH: ${gampath}\nGAMVERSION: ${GAMVERSION}"
|
|
|
|
- name: Basic Tests all jobs
|
|
run: |
|
|
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
|
|
export GAMVERSION=$($gam version simple)
|
|
echo "GAM Version ${GAMVERSION}"
|
|
echo "GAMVERSION=${GAMVERSION}" >> $GITHUB_ENV
|
|
|
|
- name: Basic Tests build jobs only
|
|
if: matrix.goal != 'test'
|
|
run: |
|
|
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}"
|
|
|
|
|
|
- name: Live API tests push only
|
|
if: github.event_name == 'push' || github.event_name == 'schedule'
|
|
env: # Or as an environment variable
|
|
PASSCODE: ${{ secrets.PASSCODE }}
|
|
run: |
|
|
source ../.github/actions/decrypt.sh ../.github/actions/creds.tar.gpg creds.tar
|
|
export OAUTHFILE="oauth2.txt-gam-gha-${JID}"
|
|
echo "OAUTHFILE=${OAUTHFILE}" >> $GITHUB_ENV
|
|
export gam_user="gam-gha-${JID}@pdl.jaylee.us"
|
|
echo "gam_user=${gam_user}" >> $GITHUB_ENV
|
|
$gam oauth info
|
|
$gam info domain
|
|
$gam oauth refresh
|
|
$gam info user
|
|
#$gam info user $gam_user grouptree
|
|
export tstamp=$(date +%s%3N)
|
|
export newbase=gha-test-$JID-$tstamp
|
|
export newuser=$newbase@pdl.jaylee.us
|
|
export newgroup=$newbase-group@pdl.jaylee.us
|
|
export newalias=$newbase-alias@pdl.jaylee.us
|
|
export newbuilding=$newbase-building
|
|
export newresource=$newbase-resource
|
|
export GAM_THREADS=5
|
|
echo email > sample.csv;
|
|
for i in {01..10}; do
|
|
echo "${newbase}-bulkuser-$i" >> sample.csv;
|
|
done
|
|
$gam create user $newuser firstname GHA lastname $JID password random recoveryphone 12125121110 recoveryemail jay0lee@gmail.com gha.jid $JID
|
|
$gam user $gam_user sendemail recipient $newuser subject "test message $newbase" message "GHA test message"
|
|
$gam user $gam_user sendemail recipient exchange@pdl.jaylee.us subject "test ${tstamp}" message "test message"
|
|
$gam create group $newgroup name "GHA $JID group" description "This is a description" isarchived true
|
|
$gam user $newuser add license gsuitebusiness
|
|
$gam update group $newgroup add owner $gam_user
|
|
$gam update group $newgroup add member $newuser
|
|
$gam csv sample.csv gam create user ~~email~~ firstname "GHA Bulk" lastname ~~email~~ gha.jid $JID
|
|
$gam csv sample.csv gam update user ~~email~~ recoveryphone 12125121110 recoveryemail jay0lee@gmail.com password random
|
|
$gam csv sample.csv gam update user ~~email~~ recoveryphone "" recoveryemail ""
|
|
$gam csv sample.csv gam user ~email add license gsuitebusiness
|
|
$gam csv sample.csv gam user $gam_user sendemail recipient ~~email~~@pdl.jaylee.us subject "test message $newbase" message "GHA test message"
|
|
$gam csv sample.csv gam update group $newgroup add member ~email
|
|
$gam info group $newgroup
|
|
$gam info cigroup $newgroup membertree
|
|
$gam user $gam_user check serviceaccount
|
|
# confirm mailbox is provisoned before continuing
|
|
$gam user $newuser waitformailbox
|
|
$gam user $newuser imap on
|
|
$gam user $newuser show imap
|
|
$gam user $newuser show delegates
|
|
#$gam user $newuser add contactdelegate "${newbase}-bulkuser-01"
|
|
#$gam user $newuser print contactdelegates
|
|
export biohazard=$(echo -e '\xe2\x98\xa3')
|
|
$gam user $newuser label "$biohazard unicode biohazard $biohazard"
|
|
$gam user $newuser show labels
|
|
$gam user $newuser show labels > labels.txt
|
|
$gam user $gam_user importemail subject "GHA import $newbase" message "This is a test import" labels IMPORTANT,UNREAD,INBOX,STARRED
|
|
$gam user $gam_user insertemail subject "GHA insert $newbase" file gam.py labels INBOX,UNREAD # yep body is gam code
|
|
$gam user $gam_user sendemail subject "GHA send $gam_user $newbase" file gam.py recipient admin@pdl.jaylee.us
|
|
$gam user $gam_user draftemail subject "GHA draft $newbase" message "Draft message test"
|
|
$gam csvfile sample.csv:email waitformailbox
|
|
$gam user $newuser delegate to "${newbase}-bulkuser-01"
|
|
$gam users "$gam_user $newbase-bulkuser-01 $newbase-bulkuser-02 $newbase-bulkuser-03" delete messages query in:anywhere maxtodelete 99999 doit
|
|
$gam users "$newbase-bulkuser-04 $newbase-bulkuser-05 $newbase-bulkuser-06" trash messages query in:anywhere maxtotrash 99999 doit
|
|
$gam users "$newbase-bulkuser-07 $newbase-bulkuser-08 $newbase-bulkuser-09" modify messages query in:anywhere maxtomodify 99999 addlabel IMPORTANT addlabel STARRED doit
|
|
$gam user $newuser delete label --ALL_LABELS--
|
|
$gam create feature name Whiteboard-$newbase
|
|
$gam create feature name VC-$newbase
|
|
$gam create building "My Building - $newbase" id $newbuilding floors 1,2,3,4,5,6,7,8,9,10,11,12,14,15 description "No 13th floor here..."
|
|
$gam create resource $newresource "Resource Calendar $tstamp" capacity 25 features Whiteboard-$newbase,VC-$newbase building $newbuilding floor 15 type Room
|
|
$gam info resource $newresource
|
|
$gam user $newuser show filelist
|
|
$gam calendar $gam_user printacl | $gam csv - gam calendar $gam_user delete id ~id # clear ACLs
|
|
$gam calendar $gam_user update read domain
|
|
$gam calendar $gam_user update freebusy default
|
|
$gam calendar $gam_user add editor $newuser
|
|
$gam calendar $gam_user showacl
|
|
$gam calendar $gam_user printacl | $gam csv - gam calendar $gam_user delete id ~id
|
|
$gam calendar $gam_user addevent summary "GHA test event" start $(date '+%FT%T.%N%:z' -d "now + 1 hour") end $(date '+%FT%T.%N%:z' -d "now + 2 hours") attendee $newgroup hangoutsmeet guestscanmodify true sendupdates all
|
|
$gam calendar $gam_user printevents after -0d
|
|
matterid=uid:$($gam create vaultmatter name "GHA matter $newbase" description "test matter" collaborators $newuser | head -1 | cut -d ' ' -f 3)
|
|
$gam create vaulthold matter $matterid name "GHA hold $newbase" corpus mail accounts $newuser
|
|
$gam print vaultmatters matterstate open
|
|
$gam print vaultholds matter $matterid
|
|
$gam print vaultcount matter $matterid corpus mail everyone todrive
|
|
$gam create vaultexport matter $matterid name "GHA export $newbase" corpus mail accounts $newuser
|
|
$gam print exports matter $matterid | $gam csv - gam info export $matterid id:~~id~~
|
|
$gam csv sample.csv gam user ~email add calendar id:$newresource
|
|
$gam delete resource $newresource
|
|
$gam delete feature Whiteboard-$newbase
|
|
$gam delete feature VC-$newbase
|
|
$gam delete building $newbuilding
|
|
$gam delete group $newgroup
|
|
$gam create alias $newalias user $newuser
|
|
$gam whatis $newuser
|
|
$gam user $gam_user show tokens
|
|
$gam print exports matter $matterid | $gam csv - gam download export $matterid id:~~id~~
|
|
$gam delete hold "GHA hold $newbase" matter $matterid
|
|
$gam update matter $matterid action close
|
|
$gam update matter $matterid action delete
|
|
$gam delete user $newuser
|
|
$gam print users query "gha.jid=$JID" | $gam csv - gam delete user ~primaryEmail
|
|
$gam print mobile
|
|
$gam print devices
|
|
$gam print browsers
|
|
export sn="$JID$JID$JID$JID-$(openssl rand -base64 32 | sed 's/[^a-zA-Z0-9]//g')"
|
|
$gam create device serialnumber $sn devicetype android
|
|
$gam print cros allfields nolists
|
|
$gam report usageparameters customer
|
|
$gam report usage customer parameters gmail:num_emails_sent,accounts:num_1day_logins
|
|
$gam report customer todrive
|
|
$gam report users fields accounts:is_less_secure_apps_access_allowed,gmail:last_imap_time,gmail:last_pop_time filters "accounts:last_login_time>2019-01-01T00:00:00.000Z" todrive
|
|
$gam report admin start -3d todrive
|
|
$gam print devices nopersonaldevices nodeviceusers filter "serial:$JID$JID$JID$JID-" | $gam csv - gam delete device id ~name
|
|
$gam print userinvitations
|
|
$gam print userinvitations | $gam csv - gam send userinvitation ~name
|
|
export CUSTOMER_ID="C01wfv983"
|
|
export GA_DOMAIN="pdl.jaylee.us"
|
|
touch $gampath/enabledasa.txt
|
|
echo "printer model count:"
|
|
$gam print printermodels | wc -l
|
|
#$gam print printers
|
|
#$gam create printer displayname "${newbase}" uri ipp://localhost:631 driverless description "made by $(date)"
|
|
rm $gampath/enabledasa.txt
|
|
|
|
- name: Upload to Google Drive, build only.
|
|
if: github.event_name == 'push' && matrix.goal != 'test'
|
|
run: |
|
|
ls gam-$GAMVERSION-*
|
|
for gamfile in gam-$GAMVERSION-*; do
|
|
echo "Uploading file ${gamfile} to Google Drive..."
|
|
fileid=$($gam user $gam_user add drivefile localfile $gamfile drivefilename $GAMVERSION-${GITHUB_SHA:0:7}-$gamfile parentid 1N2zbO33qzUQFsGM49-m9AQC1ijzd_ru1 returnidonly)
|
|
echo "file uploaded as ${fileid}, setting ACL..."
|
|
$gam user $gam_user add drivefileacl $fileid anyone role reader withlink
|
|
done
|
|
|
|
- name: Archive production artifacts
|
|
uses: actions/upload-artifact@v2
|
|
if: github.event_name == 'push' && matrix.goal != 'test'
|
|
with:
|
|
path: |
|
|
src/*.tar.xz
|
|
src/*.zip
|
|
src/*.msi
|