Skip to content

Commit

Permalink
[WIP] Add GH workflow to test copyback files from OpenBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
lcheylus committed Jan 6, 2024
1 parent d1c8e6b commit f9fdcd2
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/copyback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Copyback from VM (test)

env:
# build job configuration
STYLE_FAIL_ON_FAULT: true ## (bool) fail if the build job contains a fault (error or warning); may be overridden on a per-job basis
# cargo-nextest version to build
NEXTEST_VERSION: "0.9.66"

on:
# To run manually workflow
workflow_dispatch:

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build:
name: Download cargo-nextest
runs-on: ubuntu-latest
timeout-minutes: 90
# strategy:
# fail-fast: false
steps:
- name: Prepare OpenBSD VM and run tests
uses: vmactions/[email protected]
with:
usesh: true
sync: rsync
# copyback: false
# Install requirements
prepare: |
pkg_add -I bash curl sudo-1.9.14.2
run: |
## Prepare and test
# implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783>
# * NOTE: All steps need to be run in this block, otherwise, we are operating back on the Ubuntu host
set -e
#
BUILD_USER=builder
REPO_NAME=${GITHUB_WORKSPACE##*/}
WORKSPACE_PARENT="/home/runner/work/${REPO_NAME}"
WORKSPACE="${WORKSPACE_PARENT}/${REPO_NAME}"
# Generate random password for user
PASSWD=$(encrypt $(openssl rand -base64 12))
# Create user for build
useradd -d /root/ -g wheel -c "User to build cargo-nextest" -p ${PASSWD} ${BUILD_USER}
chown -R ${BUILD_USER}:wheel /root/ "${WORKSPACE_PARENT}"/
echo "## whoami before sudo"
whoami
#
# Further work needs to be done in a sudo as we are changing users
sudo -i -u ${BUILD_USER} bash << EOF
set -e
echo "## whoami after sudo"
whoami
# Increase the number of file descriptors - See https://github.com/rust-lang/cargo/issues/11435
ulimit -n 1024
## VARs setup
cd "${WORKSPACE}"
unset FAIL_ON_FAULT ; case '${{ env.STYLE_FAIL_ON_FAULT }}' in
''|0|f|false|n|no|off) FAULT_TYPE=warning ;;
*) FAIL_ON_FAULT=true ; FAULT_TYPE=error ;;
esac;
FAULT_PREFIX=\$(echo "\${FAULT_TYPE}" | tr '[:lower:]' '[:upper:]')
## Info
# environment
echo "## environment"
echo "CI='${CI}'"
echo "REPO_NAME='${REPO_NAME}'"
echo "BUILD_USER='${BUILD_USER}'"
echo "WORKSPACE_PARENT='${WORKSPACE_PARENT}'"
echo "WORKSPACE='${WORKSPACE}'"
echo "FAULT_PREFIX='\${FAULT_PREFIX}'"
echo "NEXTEST_VERSION='${{ env.NEXTEST_VERSION }}'"
env | sort
# tooling info
echo "## packages infos"
pkg_info
## Run build script for cargo-nextest
echo "# pwd"
pwd
echo "# download cargo-nextest sources"
curl -L https://github.com/nextest-rs/nextest/archive/refs/tags/cargo-nextest-${{ env.NEXTEST_VERSION }}.tar.gz -o cargo-nextest-${{ env.NEXTEST_VERSION }}.tar.gz
echo "# ls -l"
ls -l
EOF

0 comments on commit f9fdcd2

Please sign in to comment.