|
| 1 | +name: Test SWIG wrappers |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + swig-python: |
| 13 | + name: Python SWIG wrapper (${{ matrix.go-version }}, ${{ matrix.os }}) |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + go-version: [1.25.x, 1.26.x] |
| 17 | + os: [ubuntu-latest, macos-latest] |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + # Checkout before setup-go so go.mod is present for module cache key. |
| 26 | + - name: Install Go |
| 27 | + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 |
| 28 | + with: |
| 29 | + go-version: ${{ matrix.go-version }} |
| 30 | + |
| 31 | + - name: Install dependencies (Linux) |
| 32 | + if: runner.os == 'Linux' |
| 33 | + run: | |
| 34 | + sudo apt-get update -q |
| 35 | + sudo apt-get install -y swig python3-dev |
| 36 | +
|
| 37 | + - name: Cache Homebrew packages (macOS) |
| 38 | + if: runner.os == 'macOS' |
| 39 | + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 |
| 40 | + with: |
| 41 | + path: | |
| 42 | + ~/Library/Caches/Homebrew/downloads |
| 43 | + key: brew-swig-python-${{ runner.arch }}-${{ hashFiles('.github/workflows/swig.yml') }} |
| 44 | + restore-keys: brew-swig-python-${{ runner.arch }}- |
| 45 | + |
| 46 | + - name: Install dependencies (macOS) |
| 47 | + if: runner.os == 'macOS' |
| 48 | + run: | |
| 49 | + brew install autoconf automake libtool swig |
| 50 | +
|
| 51 | + - name: Build libcoraza |
| 52 | + run: | |
| 53 | + ./build.sh |
| 54 | + ./configure |
| 55 | + make V=1 |
| 56 | +
|
| 57 | + - name: Check SWIG interface sync |
| 58 | + run: make check-swig-sync |
| 59 | + |
| 60 | + - name: Generate and compile Python SWIG wrapper |
| 61 | + run: | |
| 62 | + make -C examples/python |
| 63 | +
|
| 64 | + - name: Run Python example |
| 65 | + run: | |
| 66 | + make -C examples/python run |
| 67 | +
|
| 68 | + swig-java: |
| 69 | + name: Java SWIG wrapper (${{ matrix.go-version }}, ${{ matrix.os }}) |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + go-version: [1.25.x, 1.26.x] |
| 73 | + os: [ubuntu-latest, macos-latest] |
| 74 | + runs-on: ${{ matrix.os }} |
| 75 | + steps: |
| 76 | + - name: Checkout code |
| 77 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 78 | + with: |
| 79 | + fetch-depth: 0 |
| 80 | + |
| 81 | + # Checkout before setup-go so go.mod is present for module cache key. |
| 82 | + - name: Install Go |
| 83 | + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 |
| 84 | + with: |
| 85 | + go-version: ${{ matrix.go-version }} |
| 86 | + |
| 87 | + # setup-java handles JDK installation on all platforms via the GitHub |
| 88 | + # tool cache, avoiding the large Temurin cask download on macOS. |
| 89 | + - name: Set up Java |
| 90 | + uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 |
| 91 | + with: |
| 92 | + java-version: '21' |
| 93 | + distribution: 'temurin' |
| 94 | + |
| 95 | + - name: Install dependencies (Linux) |
| 96 | + if: runner.os == 'Linux' |
| 97 | + run: | |
| 98 | + sudo apt-get update -q |
| 99 | + sudo apt-get install -y swig |
| 100 | +
|
| 101 | + - name: Cache Homebrew packages (macOS) |
| 102 | + if: runner.os == 'macOS' |
| 103 | + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 |
| 104 | + with: |
| 105 | + path: | |
| 106 | + ~/Library/Caches/Homebrew/downloads |
| 107 | + key: brew-swig-java-${{ runner.arch }}-${{ hashFiles('.github/workflows/swig.yml') }} |
| 108 | + restore-keys: brew-swig-java-${{ runner.arch }}- |
| 109 | + |
| 110 | + - name: Install dependencies (macOS) |
| 111 | + if: runner.os == 'macOS' |
| 112 | + run: | |
| 113 | + brew install autoconf automake libtool swig |
| 114 | +
|
| 115 | + - name: Build libcoraza |
| 116 | + run: | |
| 117 | + ./build.sh |
| 118 | + ./configure |
| 119 | + make V=1 |
| 120 | +
|
| 121 | + - name: Check SWIG interface sync |
| 122 | + run: make check-swig-sync |
| 123 | + |
| 124 | + - name: Generate and compile Java SWIG wrapper |
| 125 | + run: | |
| 126 | + make -C examples/java |
| 127 | +
|
| 128 | + - name: Run Java example |
| 129 | + run: | |
| 130 | + make -C examples/java run |
0 commit comments