| 1 |
name: Run Tests |
| 2 |
|
| 3 |
on: [push, pull_request] |
| 4 |
|
| 5 |
jobs: |
| 6 |
test: |
| 7 |
runs-on: ubuntu-latest |
| 8 |
container: |
| 9 |
image: registry.fedoraproject.org/fedora:latest |
| 10 |
options: --privileged --cap-add=NET_ADMIN --cap-add=NET_RAW -v /lib/modules:/lib/modules |
| 11 |
steps: |
| 12 |
- uses: actions/checkout@v4 |
| 13 |
- name: Install tools |
| 14 |
run: | |
| 15 |
sudo dnf -y install ShellCheck bats golang criu asciidoctor iptables iproute kmod jq bash bash-completion zsh fish |
| 16 |
sudo modprobe -va ip_tables ip6table_filter nf_conntrack nf_conntrack_netlink |
| 17 |
- name: Run make shellcheck |
| 18 |
run: make shellcheck |
| 19 |
- name: Run make all |
| 20 |
run: make all |
| 21 |
- name: Run make test |
| 22 |
run: sudo -E make test |
| 23 |
- name: Run make test-junit |
| 24 |
run: sudo -E make test-junit |
| 25 |
- name: Upload Test Results |
| 26 |
# To display test results from forked repositories they need to |
| 27 |
# be uploaded and then analyzed. |
| 28 |
if: always() |
| 29 |
uses: actions/upload-artifact@v4 |
| 30 |
with: |
| 31 |
name: test-results |
| 32 |
retention-days: 1 |
| 33 |
path: test/junit.xml |
| 34 |
- name: Run make install/uninstall |
| 35 |
run: test/uninstall.sh |
| 36 |
- name: Run make validate.completions |
| 37 |
run: make validate.completions |
| 38 |
|
| 39 |
event_file: |
| 40 |
name: "Event File" |
| 41 |
runs-on: ubuntu-latest |
| 42 |
steps: |
| 43 |
- name: Upload |
| 44 |
if: always() |
| 45 |
uses: actions/upload-artifact@v4 |
| 46 |
with: |
| 47 |
name: event-file |
| 48 |
retention-days: 1 |
| 49 |
path: ${{ github.event_path }} |
| 50 |
|
| 51 |
release: |
| 52 |
runs-on: ubuntu-latest |
| 53 |
steps: |
| 54 |
- name: Checkout code |
| 55 |
uses: actions/checkout@v4 |
| 56 |
|
| 57 |
- name: Build release binary |
| 58 |
run: make release |
| 59 |
|
| 60 |
- name: Check static binary |
| 61 |
run: | |
| 62 |
file_output=$(file checkpointctl) |
| 63 |
if [[ "$file_output" =~ .*statically\ linked.* ]]; then |
| 64 |
echo "Binary is static" |
| 65 |
exit 0 |
| 66 |
else |
| 67 |
echo "Binary is not static" |
| 68 |
exit 1 |
| 69 |
fi |