move common code to function #5315
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI FreeBSD | |
on: | |
push: | |
branches-ignore: | |
- coverity_scan | |
- run-fuzzer** | |
- debug-fuzzer-** | |
pull_request: | |
env: | |
HOSTAPD_BUILD_DIR: eapol_test.ci | |
HOSTAPD_GIT_TAG: hostap_2_11 | |
NO_PERFORMANCE_TESTS: yes | |
jobs: | |
freebsd-build: | |
runs-on: ubuntu-latest | |
name: "FreeBSD build" | |
steps: | |
# Checkout, but defer pulling LFS objects until we've restored the cache | |
- uses: actions/checkout@v4 | |
with: | |
lfs: false | |
path: freeradius | |
- name: Create LFS file list as cache key | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
working-directory: freeradius | |
- name: Restore LFS cache | |
uses: actions/cache@v4 | |
id: lfs-cache | |
with: | |
path: .git/lfs | |
key: freebsd-lfs-${{ hashFiles('freeradius/.lfs-assets-id') }}-v1 | |
# Now the LFS pull will be local if we hit the cache, or remote otherwise | |
- name: Git LFS pull | |
run: git lfs pull | |
working-directory: freeradius | |
- name: Restore eapol_test build directory from cache | |
uses: actions/cache@v4 | |
id: hostapd-cache | |
with: | |
path: ${{ env.HOSTAPD_BUILD_DIR }} | |
key: hostapd-freebsd-${{ env.HOSTAPD_GIT_TAG }}-v4 | |
- name: Test using a FreeBSD VirtualBox VM | |
uses: cross-platform-actions/[email protected] | |
with: | |
operating_system: freebsd | |
version: '14.0' | |
sync_files: runner-to-vm | |
memory: 4G | |
environment_variables: HOSTAPD_BUILD_DIR HOSTAPD_GIT_TAG NO_PERFORMANCE_TESTS | |
run: | | |
sudo pkg install -y \ | |
brotli \ | |
curl \ | |
cyrus-sasl \ | |
freetds \ | |
git \ | |
git-lfs \ | |
gmake \ | |
google-perftools \ | |
hiredis \ | |
json-c \ | |
libidn \ | |
libmemcached \ | |
libpcap \ | |
libyubikey \ | |
lua52 \ | |
luajit-devel \ | |
mariadb-connector-c \ | |
net-snmp \ | |
openldap25-client \ | |
python3 \ | |
py311-pip \ | |
postgresql12-client \ | |
sqlite3 \ | |
talloc \ | |
unixODBC | |
PIP_BREAK_SYSTEM_PACKAGES=1 pip install tacacs_plus | |
echo "#! /bin/sh" | sudo tee /usr/local/bin/nproc | |
echo "sysctl -n hw.ncpu" | sudo tee -a /usr/local/bin/nproc | |
sudo chmod +x /usr/local/bin/nproc | |
freebsd-version | |
cd freeradius | |
./configure | |
gmake -j `nproc` | |
gmake -j `nproc` test.keywords test.unit test.modules test.auth test.digest | |
gmake test | |
# | |
# If the CI has failed and the branch is ci-debug then we start a tmate | |
# session to provide interactive shell access to the session. | |
# | |
# The SSH rendezvous point will be emited continuously in the job output, | |
# which will look something like: | |
# | |
# SSH: ssh [email protected] | |
# | |
# For example: | |
# | |
# git push origin ci-debug --force | |
# | |
# Look at the job output in: https://github.com/FreeRADIUS/freeradius-server/actions | |
# | |
# ssh [email protected] | |
# | |
# Access requires that you have the private key corresponding to the | |
# public key of the GitHub user that initiated the job. | |
# | |
# The above will open a shell for the MacOS environment on which the | |
# FreeBSD VM is running within VirtualBox. | |
# | |
# Access the FreeBSD VM with: | |
# | |
# ssh -t freebsd | |
# | |
# The working directory is: | |
# | |
# /User/runner/work | |
# | |
- name: "Debug: Start tmate" | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
limit-access-to-actor: true | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ github.ref == 'refs/heads/ci-debug' && failure() }} | |