name: Build and test GAM on: push: pull_request: schedule: - cron: '37 22 * * *' defaults: run: shell: bash working-directory: src env: OPENSSL_CONFIG_OPTS: no-asm no-fips OPENSSL_INSTALL_PATH: ${{ github.workspace }}/src/ssl OPENSSL_SOURCE_PATH: ${{ github.workspace }}/src/openssl PYTHON_INSTALL_PATH: ${{ github.workspace }}/src/python PYTHON_SOURCE_PATH: ${{ github.workspace }}/src/cpython jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: include: - os: ubuntu-20.04 jid: 2 goal: build arch: x86_64 openssl_archs: linux-x86_64 - os: macos-11 jid: 3 goal: build arch: x86_64 openssl_archs: darwin64-x86_64 darwin64-arm64 - os: windows-2022 jid: 4 goal: build arch: Win64 openssl_archs: VC-WIN64A - os: windows-2022 jid: 5 goal: build arch: Win32 openssl_archs: VC-WIN32 - os: ubuntu-20.04 goal: test python: "3.7" jid: 6 arch: x86_64 - os: ubuntu-20.04 goal: test python: "3.8" jid: 7 arch: x86_64 - os: ubuntu-20.04 goal: test python: "3.9" jid: 8 arch: x86_64 - os: [self-hosted, linux, arm64] jid: 9 goal: build arch: aarch64 openssl_archs: linux-aarch64 - os: [self-hosted, linux, arm] jid: 10 goal: build arch: armv7l openssl_archs: linux-armv4 steps: - uses: actions/checkout@master with: persist-credentials: false fetch-depth: 0 - name: Cache multiple paths uses: actions/cache@v2 id: cache-python-ssl with: path: | src/python src/ssl key: gam-${{ matrix.jid }}-20220228 - name: Use pre-compiled Python for testing if: matrix.python != '' uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - name: Set env variables for test if: matrix.goal == 'test' env: JID: ${{ matrix.jid }} ACTIONS_CACHE: ${{ steps.cache-python-ssl.outputs.cache-hit }} ACTIONS_GOAL: ${{ matrix.goal }} run: | export PYTHON=$(which python3) export PIP=$(which pip3) export gam="${PYTHON} -m gam" export gampath="$(readlink -e .)" echo -e "PYTHON: ${PYTHON}\nPIP: ${PIP}\gam: ${gam}\ngampath: ${gampath}" echo "PYTHON=${PYTHON}" >> $GITHUB_ENV echo "PIP=${PIP}" >> $GITHUB_ENV echo "gam=${gam}" >> $GITHUB_ENV echo "gampath=${gampath}" >> $GITHUB_ENV echo "JID=${JID}" >> $GITHUB_ENV echo "ACTIONS_CACHE=${ACTIONS_CACHE}" >> $GITHUB_ENV echo "ACTIONS_GOAL=${ACTIONS_GOAL}" >> $GITHUB_ENV echo "date=date" >> $GITHUB_ENV - name: Install necessary hosted Linux packages if: matrix.os == 'ubuntu-20.04' run: | echo "RUNNING: apt update..." sudo apt-get -qq --yes update sudo apt-get -qq --yes install swig libpcsclite-dev - name: Windows Configure VCode uses: ilammy/msvc-dev-cmd@v1 if: matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' with: arch: ${{ matrix.arch }} - name: Set Env Variables for build if: matrix.goal == 'build' env: arch: ${{ matrix.arch }} jid: ${{ matrix.jid }} openssl_archs: ${{ openssl_archs }} run: | echo "We are running on ${RUNNER_OS}" if [[ "${arch}" == "Win64" ]]; then PYEXTERNALS_PATH="amd64" PYBUILDRELEASE_ARCH="x64" GAM_ARCHIVE_ARCH="x86_64" WIX_ARCH="x64" CHOC_OPS="" elif [[ "${arch}" == "Win32" ]]; then PYEXTERNALS_PATH="win32" PYBUILDRELEASE_ARCH="Win32" GAM_ARCHIVE_ARCH="x86" WIX_ARCH="x86" CHOC_OPS="--forcex86" fi if [[ "${RUNNER_OS}" == "macOS" ]]; then brew install coreutils brew install bash MAKE=make MAKEOPT="-j$(sysctl -n hw.logicalcpu)" PERL=perl # We only care about non-deprecated OSes MACOSX_DEPLOYMENT_TARGET="10.15" echo "MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}" >> $GITHUB_ENV echo "PYTHON=${PYTHON_INSTALL_PATH}/bin/python3" >> $GITHUB_ENV export date=gdate export realpath=grealpath echo "CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1" >> $GITHUB_ENV echo "CFLAGS=-I${HOME}/ssl/include -arch arm64 -arch x86_64" >> $GITHUB_ENV echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV echo "LDFLAGS=${HOME}/ssl/lib/libssl.a" >> $GITHUB_ENV echo "ARCHFLAGS=-arch x86_64 -arch arm64" >> $GITHUB_ENV echo 'PIP_ARGS=( "--no-binary" ":all:" )' >> $GITHUB_ENV elif [[ "${RUNNER_OS}" == "Linux" ]]; then MAKE=make MAKEOPT="-j$(nproc)" PERL=perl echo "PYTHON=${PYTHON_INSTALL_PATH}/bin/python3" >> $GITHUB_ENV export date=date export realpath=realpath elif [[ "${RUNNER_OS}" == "Windows" ]]; then MAKE=nmake MAKEOPT="" PERL="c:\strawberry\perl\bin\perl.exe" echo "PYTHON=${PYTHON_INSTALL_PATH}\python.exe" >> $GITHUB_ENV export date=date export realpath=realpath echo "GAM_ARCHIVE_ARCH=${GAM_ARCHIVE_ARCH}" >> $GITHUB_ENV echo "WIX_ARCH=${WIX_ARCH}" >> $GITHUB_ENV fi echo "date=${date}" >> $GITHUB_ENV echo "realpath=${realpath}" >> $GITHUB_ENV echo "We'll run make with: ${MAKEOPT}" echo "JID=${jid}" >> $GITHUB_ENV echo "arch=${arch}" >> $GITHUB_ENV echo "MAKE=${MAKE}" >> $GITHUB_ENV echo "MAKEOPT=${MAKEOPT}" >> $GITHUB_ENV echo "PERL=${PERL}" >> $GITHUB_ENV echo "PYEXTERNALS_PATH=${PYEXTERNALS_PATH}" >> $GITHUB_ENV echo "PYBUILDRELEASE_ARCH=${PYBUILDRELEASE_ARCH}" >> $GITHUB_ENV echo "openssl_archs=${openssl_archs}" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=${OPENSSL_INSTALL_PATH}/lib:${PYTHON_INSTALL_PATH}/lib" >> $GITHUB_ENV #echo "PATH=${PATH}:${PYTHON_INSTALL_PATH}/scripts" >> $GITHUB_ENV - name: Get latest stable OpenSSL source if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | git clone https://github.com/openssl/openssl.git cd "${OPENSSL_SOURCE_PATH}" export LATEST_STABLE_TAG=$(git tag --list openssl-* | grep -v alpha | grep -v beta | sort -Vr | head -n1) echo "Checking out version ${LATEST_STABLE_TAG}" git checkout "${LATEST_STABLE_TAG}" export COMPILED_OPENSSL_VERSION=${LATEST_STABLE_TAG:8} # Trim the openssl- prefix echo "COMPILED_OPENSSL_VERSION=${COMPILED_OPENSSL_VERSION}" >> $GITHUB_ENV cd ~ for openssl_arch in $openssl_archs; do ssldir="openssl-${openssl_arch}" mkdir "{ssldir}" cp -rf openssl/* "${ssldir}/" done rm -rf openssl - name: Windows NASM Install uses: ilammy/setup-nasm@v1 if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' - name: Config OpenSSL if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | for openssl_arch in $openssl_archs; do cd "openssl-${openssl_arch}" # --libdir=lib is needed so Python can find OpenSSL libraries "${PERL}" ./Configure "${openssl_archs}" --libdir=lib --prefix="${OPENSSL_INSTALL_PATH}-${openssl_arch}" $OPENSSL_CONFIG_OPTS done - name: Rename GNU link on Windows if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' shell: bash run: mv /usr/bin/link /usr/bin/gnulink - name: Make OpenSSL if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | for openssl_arch in $openssl_archs; do cd "openssl-${openssl_arch}" $MAKE "${MAKEOPT}" done - name: Install OpenSSL if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | for openssl_arch in $openssl_archs; do cd "openssl-${openssl_arch}" # install_sw saves us ages processing man pages :-) $MAKE install_sw done mkdir ssl if [[ "${RUNNER_OS}" == "macOS" ]]; then mkdir ssl/lib mdkir ssl/bin for archlib in libcrypto.3.dylib libssl.3.dylib libcrypto.a libssl.a; do lipo -create "ssl-darwin64-x86_64/lib/${archlib}" \ "ssl-darwin64-arm64/lib/${archlib}" \ -output "ssl/lib/${archlib}" done mv ssl-darwin64-x86_64/include ssl/ lipo -create "ssl-darwin64-x86_64/bin/openssl" \ "ssl-darwin64-arm64/bin/openssl" \ -output "nssl/bin/openssl" rm -rf ssl-darwin64-x86_64 rm -rf ssl-darwin64-arm64 else mv "ssl-${openssl_archs}" ssl fi - name: Run OpenSSL if: matrix.goal == 'build' run: | "${OPENSSL_INSTALL_PATH}/bin/openssl" version file "${OPENSSL_INSTALL_PATH}/bin/openssl" - name: Get latest stable Python source if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | git clone https://github.com/python/cpython.git cd "${PYTHON_SOURCE_PATH}" export LATEST_STABLE_TAG=$(git tag --list | grep -v a | grep -v rc | grep -v b | sort -Vr | head -n1) git checkout "${LATEST_STABLE_TAG}" export COMPILED_PYTHON_VERSION=${LATEST_STABLE_TAG:1} # Trim the "v" prefix echo "COMPILED_PYTHON_VERSION=${COMPILED_PYTHON_VERSION}" >> $GITHUB_ENV - name: Mac/Linux Configure Python if: matrix.goal == 'build' && matrix.os != 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | cd "${PYTHON_SOURCE_PATH}" if [[ "${RUNNER_OS}" == "macOS" ]]; then extra_args=( "--enable-universalsdk" "--with-universal-archs=universal2" ) else extra_args=( ) ./configure --with-openssl="${OPENSSL_INSTALL_PATH}" \ --prefix="${PYTHON_INSTALL_PATH}" \ --enable-shared \ --with-ensurepip=upgrade \ --enable-optimizations \ --with-lto \ "${extra_args[@]}" - name: Windows Get External Python deps if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' shell: powershell run: | cd "${env:PYTHON_SOURCE_PATH}" PCBuild\get_externals.bat - name: Windows overwrite external OpenSSL with local if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' shell: powershell run: | cd "${env:PYTHON_SOURCE_PATH}" $env:OPENSSL_EXT_PATH = "$(Get-Item externals\openssl-bin-* | Select -exp FullName)\" echo "External OpenSSL was downloaded to ${env:OPENSSL_EXT_PATH}" Remove-Item -recurse -force "${env:OPENSSL_EXT_PATH}*" # Emulate what this script does: # https://github.com/python/cpython/blob/main/PCbuild/openssl.vcxproj $env:OPENSSL_EXT_TARGET_PATH = "${env:OPENSSL_EXT_PATH}${env:PYEXTERNALS_PATH}" echo "Copying our OpenSSL to ${env:OPENSSL_EXT_TARGET_PATH}" mkdir "${env:OPENSSL_EXT_TARGET_PATH}\include\openssl\" Copy-Item -Path "${env:OPENSSL_SOURCE_PATH}\LICENSE.txt" -Destination "${env:OPENSSL_EXT_TARGET_PATH}\LICENSE" cp -v "$env:OPENSSL_INSTALL_PATH\lib\*" "${env:OPENSSL_EXT_TARGET_PATH}" cp -v "$env:OPENSSL_INSTALL_PATH\bin\*" "${env:OPENSSL_EXT_TARGET_PATH}" cp -v "$env:OPENSSL_INSTALL_PATH\include\openssl\*" "${env:OPENSSL_EXT_TARGET_PATH}\include\openssl\" cp -v "$env:OPENSSL_INSTALL_PATH\include\openssl\applink.c" "${env:OPENSSL_EXT_TARGET_PATH}\include\" - name: Windows Install sphinx-build if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' shell: powershell run: | pip install --upgrade pip pip install --upgrade sphinx sphinx-build --version - name: Windows Config/Build Python if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' shell: powershell run: | cd "${env:PYTHON_SOURCE_PATH}" # We need out custom openssl.props which uses OpenSSL 3 DLL names Copy-Item -Path "${env:GITHUB_WORKSPACE}\src\tools\openssl.props" -Destination PCBuild\ echo "Building for ${env:PYBUILDRELEASE_ARCH}..." PCBuild\build.bat -m --pgo -c Release -p "${env:PYBUILDRELEASE_ARCH}" - name: Windows Install Python if: matrix.goal == 'build' && matrix.os == 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' shell: powershell run: | cd "${env:PYTHON_SOURCE_PATH}" mkdir "${env:PYTHON_INSTALL_PATH}\lib" mkdir "${env:PYTHON_INSTALL_PATH}\include" Copy-Item -Path "PCBuild\${env:PYEXTERNALS_PATH}\*" "${env:PYTHON_INSTALL_PATH}\" Copy-Item -Path "${env:PYTHON_SOURCE_PATH}\Lib\*" "${env:PYTHON_INSTALL_PATH}\lib\" -recurse Copy-Item -Path "${env:PYTHON_SOURCE_PATH}\Include\*" "${env:PYTHON_INSTALL_PATH}\include\" -recurse Copy-Item -Path "${env:PYTHON_SOURCE_PATH}\PC\*.h" "${env:PYTHON_INSTALL_PATH}\include\" - name: Mac/Linux Build Python if: matrix.goal == 'build' && matrix.os != 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | cd "${PYTHON_SOURCE_PATH}" echo "Running: ${MAKE} ${MAKEOPT}" $MAKE $MAKEOPT - name: Mac/Linux Install Python if: matrix.goal == 'build' && matrix.os != 'windows-2022' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | cd "${PYTHON_SOURCE_PATH}" $MAKE altinstall $MAKE bininstall - name: Run Python run: | "${PYTHON}" -V - name: Upgrade pip, wheel, etc run: | curl -O https://bootstrap.pypa.io/get-pip.py "${PYTHON}" get-pip.py "${PYTHON}" -m pip install --upgrade pip "${PYTHON}" -m pip install --upgrade wheel "${PYTHON}" -m pip install --upgrade setuptools - name: Install PyInstaller if: matrix.goal == 'build' run: | git clone https://github.com/pyinstaller/pyinstaller.git cd pyinstaller export latest_release=$(git tag --list | grep -v dev | grep -v rc | sort -Vr | head -n1) git checkout "${latest_release}" # remove pre-compiled bootloaders so we fail if bootloader compile fails rm -rvf PyInstaller/bootloader/*-*/* cd bootloader if [[ "${arch}" == "Win32" ]]; then export PYINSTALLER_BUILD_ARGS="--target-arch=32bit" fi echo "PyInstaller build arguments: ${PYINSTALLER_BUILD_ARGS}" "${PYTHON}" ./waf all $PYINSTALLER_BUILD_ARGS cd .. "${PYTHON}" -m pip install . - name: Install pip requirements run: | set +e "${PYTHON}" -m pip install --upgrade -r requirements.txt "${PIP_ARGS[@]}" "${PYTHON}" -m pip list - name: Build GAM with PyInstaller if: matrix.goal != 'test' run: | export gampath="./dist/gam" mkdir -p -v "${gampath}" export gampath="$($realpath $gampath)" export gam="${gampath}/gam" echo "gampath=${gampath}" >> $GITHUB_ENV echo "gam=${gam}" >> $GITHUB_ENV echo -e "GAM: ${gam}\nGAMPATH: ${gampath}" "${PYTHON}" -m PyInstaller --clean --noupx --strip --onefile --distpath="${gampath}" gam.spec - name: Basic Tests all jobs run: | $PYTHON -m unittest discover --start-directory ./ --pattern "*_test.py" --buffer $gam version extended export GAMVERSION=$($gam version simple) echo "GAM Version ${GAMVERSION}" echo "GAMVERSION=${GAMVERSION}" >> $GITHUB_ENV - name: Linux/MacOS package if: matrix.os != 'windows-2022' && matrix.goal == 'build' run: | cp -v LICENSE $gampath cp -v GamCommands.txt $gampath if [[ "${RUNNER_OS}" == "macOS" ]]; then GAM_ARCHIVE="gam-${GAMVERSION}-macos-x86_64.tar.xz" elif [[ "${RUNNER_OS}" == "Linux" ]]; then this_glibc_ver=$(ldd --version | awk '/ldd/{print $NF}') GAM_ARCHIVE="gam-${GAMVERSION}-linux-$(arch)-glibc${this_glibc_ver}.tar.xz" fi tar -C dist/ --create --verbose --exclude-from "${GITHUB_WORKSPACE}/.github/actions/package_exclusions.txt" --file $GAM_ARCHIVE --xz gam - name: Linux install patchelf/staticx if: matrix.os == 'ubuntu-20.04' && matrix.goal != 'test' run: | "${PYTHON}" -m pip install --upgrade patchelf-wrapper "${PYTHON}" -m pip install --upgrade staticx - name: Linux Make Static if: matrix.os == 'ubuntu-20.04' && matrix.goal != 'test' run: | $PYTHON -m staticx "${gam}" "${gam}-staticx" - name: Linux Run StaticX-ed if: matrix.os == 'ubuntu-20.04' && matrix.goal != 'test' run: | "${gam}-staticx" version extended mv -v "${gam}-staticx" "${gam}" - name: Linux package staticx if: matrix.os == 'ubuntu-20.04' && matrix.goal != 'test' run: | GAM_ARCHIVE="gam-${GAMVERSION}-linux-x86_64-legacy.tar.xz" tar -C dist/ --create --verbose --exclude-from "${GITHUB_WORKSPACE}/.github/actions/package_exclusions.txt" --file $GAM_ARCHIVE --xz gam - name: Windows package if: matrix.os == 'windows-2022' && matrix.goal != 'test' run: | cp -v LICENSE $gampath cp -v GamCommands.txt $gampath cp -v gam-setup.bat $gampath cd dist/ GAM_ARCHIVE="../gam-${GAMVERSION}-windows-${GAM_ARCHIVE_ARCH}.zip" /c/Program\ Files/7-Zip/7z.exe a -tzip $GAM_ARCHIVE gam "-xr@${GITHUB_WORKSPACE}/.github/actions/package_exclusions.txt" -bb3 cd .. /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/candle.exe -arch "${WIX_ARCH}" gam.wxs /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/light.exe -ext /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/WixUIExtension.dll gam.wixobj -o "gam-${GAMVERSION}-windows-${GAM_ARCHIVE_ARCH}.msi" || true; rm -v -f *.wixpdb - name: Basic Tests build jobs only if: matrix.goal != 'test' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | export voutput=$($gam version extended) export python_line=$(echo -e "${voutput}" | grep "Python ") export python_arr=($python_line) export this_python=${python_arr[1]} if [[ "${this_python}" != "${COMPILED_PYTHON_VERSION}" ]]; then echo "ERROR: Tried to compile Python ${COMPILED_PYTHON_VERSION} but ended up with ${this_python}" exit 1 fi export openssl_line=$(echo -e "${voutput}" | grep "OpenSSL ") export openssl_arr=($openssl_line) export this_openssl="${openssl_arr[1]}" if [[ "${this_openssl}" != "${COMPILED_OPENSSL_VERSION}" ]]; then echo "ERROR: Tried to compile OpenSSL ${COMPILED_OPENSSL_VERSION} but ended up with ${this_openssl}" exit 1 fi echo "We successfully compiled Python ${this_python} and OpenSSL ${this_openssl}" - name: Live API tests push only if: github.event_name == 'push' || github.event_name == 'schedule' env: 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 languages en+,en-GB- $gam user $newuser update photo https://dummyimage.com/400x600/000/fff $gam user $newuser get photo $gam user $newuser delete photo $gam create group $newgroup name "GHA $JID group" description "This is a description" isarchived true $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 update cigroup $newgroup memberrestriction 'member.type == 1 || member.customer_id == groupCustomerId()' $gam info cigroup $newgroup $gam user $newuser add license workspaceenterpriseplus $gam update group $newgroup add owner $gam_user $gam update group $newgroup add member $newuser $gam print privileges $gam create admin $newuser _GROUPS_EDITOR_ROLE CUSTOMER condition nonsecuritygroup $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 workspaceenterpriseplus $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_CSV_ROW_FILTER="name:regex:gha-test-${JID}" $gam print features | $gam csv - gam delete feature ~name $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 use_new_export true $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 user $newuser delete license workspaceenterpriseplus $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 undelete user $newuser $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 orderby serialnumber #$gam show crostelemetry storagepercentonly $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 -f -v $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: name: gam-binaries path: | src/*.tar.xz src/*.zip src/*.msi