Skip to content

Prepare libsodium-bindings-0.0.2.0 (#162) #503

Prepare libsodium-bindings-0.0.2.0 (#162)

Prepare libsodium-bindings-0.0.2.0 (#162) #503

name: libsodium-bindings
# Trigger the workflow on push or pull request, but only for the main branch
on:
pull_request:
push:
branches: ["main"]
jobs:
generateMatrix:
name: "Generate matrix from cabal"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Extract the tested GHC versions
id: set-matrix
uses: kleidukos/[email protected]
with:
cabal-file: libsodium-bindings/libsodium-bindings.cabal
ubuntu-version: "latest"
macos-version: "latest"
version: 0.1.7.0
tests:
name: ${{ matrix.ghc }} on ${{ matrix.os }}
needs: generateMatrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
steps:
- name: Checkout base repo
uses: actions/checkout@v4
- name: Set up Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 'latest'
- name: Install libsodium-dev on ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt install libsodium-dev
- name: Freeze
run: cabal freeze
- name: Cache
uses: actions/cache@v4
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}-
- name: Build libsodium-bindings with homebrew
if: ${{ matrix.os == 'macos-latest' }}
run: |
cabal build -v2 --project-file=cabal.homebrew.project libsodium-bindings
- name: Build sel with homebrew
if: ${{ matrix.os == 'macos-latest' }}
run: |
cabal build --project-file=cabal.homebrew.project -v2 sel
cabal test --project-file=cabal.homebrew.project sel
- name: Build libsodium-bindings with pkg-config
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cabal build --project-file=cabal.pkg-config.project -v2 libsodium-bindings
- name: Build sel with pkg-config
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cabal build --project-file=cabal.pkg-config.project -v2 sel
cabal test --project-file=cabal.pkg-config.project sel
api-stabiity:
name: API Stability
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout base repo
uses: actions/checkout@v4
- name: Install libsodium-dev on ubuntu
run: |
sudo apt install libsodium-dev
- name: Set up Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: '9.8.2'
cabal-version: 'latest'
- name: Freeze
run: cabal freeze --project-file=cabal.pkg-config.project
- name: Cache
uses: actions/[email protected]
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }}-cabal-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }}-
- name: Build
run: cabal build --project-file=cabal.pkg-config.project --write-ghc-environment-files=always sel
- name: Diff the expected and actual package APIs
uses: kleidukos/[email protected]
with:
package-name: sel
expected-interface: sel/test/package-api-${{ steps.setup-haskell.outputs.ghc-version }}.txt
ghc: ${{ steps.setup-haskell.outputs.ghc-version }}
version: 0.1.0.1 # This is the version of the print-api tool