test/Makefile: misc fixes #14
Workflow file for this run
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 | |
on: | |
push: | |
pull_request: | |
env: | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
PLATFORMS: linux/amd64 | |
permissions: | |
packages: write | |
jobs: | |
make_check: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Checkout sfunnel" | |
uses: actions/checkout@v4 | |
with: | |
path: sfunnel | |
fetch-depth: 0 | |
fetch-tags: 1 | |
- name: "Install deps..." | |
run: | | |
sudo add-apt-repository universe | |
sudo apt-get update | |
sudo apt-get install -y clang make iproute2 bridge-utils python3 \ | |
python3-scapy python3-pip libbpf-dev \ | |
libelf-dev linux-headers-generic \ | |
linux-libc-dev llvm iptables | |
sudo pip3 install pytest | |
sudo ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/asm | |
- name: "Allow test traffic in iptables/nftables" | |
run: | | |
sudo iptables -L -n | |
sudo iptables -t nat -L -n | |
sudo iptables -I FORWARD -s 11.1.1.1 -j ACCEPT | |
- name: "Run tests..." | |
run: cd sfunnel/test && make VERBOSE=1 | |
docker_build_and_publish: | |
needs: [make_check] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Checkout sfunnel" | |
uses: actions/checkout@v4 | |
with: | |
path: sfunnel | |
fetch-depth: 0 | |
fetch-tags: 1 | |
- name: "Set up Docker buildx" | |
uses: docker/setup-buildx-action@v3 | |
- name: "Login to GitHub Container Registry (ghcr.io)" | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: "Build and push to ghcr" | |
run: | | |
#Cross-build | |
cd sfunnel | |
echo "Fix mess with tags in actions/checkout..." | |
git fetch -f && git fetch -f --tags | |
export TAG=$(git describe HEAD | sed 's/-.*$//g' | tr -d "v") | |
EXACT_TAG=$(git describe --exact-match --match "v*" || echo "") | |
if [[ "${EXACT_TAG}" != "" ]]; then | |
echo "Cross-building and PUSHING!" | |
docker buildx build --platform ${PLATFORMS} --push -f docker/Dockerfile . --tag ghcr.io/${GITHUB_REPOSITORY}:${TAG} | |
else | |
echo "Cross-building ONLY" | |
docker buildx build --platform ${PLATFORMS} -f docker/Dockerfile . | |
fi |