|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master, devel] |
| 6 | + pull_request: |
| 7 | + branches: [master, devel] |
| 8 | + release: |
| 9 | + types: [created] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-linux: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + container: |
| 15 | + image: ${{ matrix.container }} |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - container: fedora:latest |
| 20 | + deps: dnf install -y gcc make autoconf automake libpcap-devel libevent-devel libdnet-devel |
| 21 | + - container: rockylinux:9 |
| 22 | + deps: dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb && dnf install -y epel-release && dnf install -y gcc make autoconf automake libpcap-devel libevent-devel libdnet-devel |
| 23 | + - container: ubuntu:latest |
| 24 | + deps: apt-get update && apt-get install -y gcc make autoconf automake libpcap-dev libevent-dev libdumbnet-dev |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout code |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: ${{ matrix.deps }} |
| 32 | + |
| 33 | + - name: Autoreconf |
| 34 | + run: autoreconf -f -i |
| 35 | + |
| 36 | + - name: Configure |
| 37 | + run: ./configure |
| 38 | + |
| 39 | + - name: Build |
| 40 | + run: make |
| 41 | + |
| 42 | + - name: Test binary |
| 43 | + run: ./scanssh -V |
| 44 | + |
| 45 | + build-macos: |
| 46 | + runs-on: macos-latest |
| 47 | + steps: |
| 48 | + - name: Checkout code |
| 49 | + uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + run: brew install autoconf automake libpcap libevent libdnet |
| 53 | + |
| 54 | + - name: Autoreconf |
| 55 | + run: autoreconf -f -i |
| 56 | + |
| 57 | + - name: Configure |
| 58 | + run: | |
| 59 | + ./configure \ |
| 60 | + --with-libpcap=$(brew --prefix libpcap) \ |
| 61 | + --with-libevent=$(brew --prefix libevent) \ |
| 62 | + --with-libdnet=$(brew --prefix libdnet) |
| 63 | +
|
| 64 | + - name: Build |
| 65 | + run: make |
| 66 | + |
| 67 | + - name: Test binary |
| 68 | + run: ./scanssh -V |
| 69 | + |
| 70 | + build-freebsd: |
| 71 | + runs-on: ubuntu-latest |
| 72 | + steps: |
| 73 | + - name: Checkout code |
| 74 | + uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Build on FreeBSD |
| 77 | + uses: vmactions/freebsd-vm@v1 |
| 78 | + with: |
| 79 | + usesh: true |
| 80 | + prepare: pkg install -y gcc gmake autoconf automake libpcap libevent libdnet |
| 81 | + run: | |
| 82 | + autoreconf -f -i |
| 83 | + ./configure |
| 84 | + make |
| 85 | + ./scanssh -V |
| 86 | +
|
| 87 | + create-dist: |
| 88 | + runs-on: ubuntu-latest |
| 89 | + container: fedora:latest |
| 90 | + needs: [build-linux, build-macos, build-freebsd] |
| 91 | + if: github.event_name == 'release' |
| 92 | + steps: |
| 93 | + - name: Checkout code |
| 94 | + uses: actions/checkout@v4 |
| 95 | + |
| 96 | + - name: Install dependencies |
| 97 | + run: dnf install -y gcc make autoconf automake libpcap-devel libevent-devel libdnet-devel |
| 98 | + |
| 99 | + - name: Create distribution |
| 100 | + run: | |
| 101 | + autoreconf -f -i |
| 102 | + ./configure |
| 103 | + make dist |
| 104 | +
|
| 105 | + - name: Upload release asset |
| 106 | + uses: softprops/action-gh-release@v2 |
| 107 | + with: |
| 108 | + files: scanssh-*.tar.gz |
0 commit comments