# Copyright (c) 2022-2024 Yubico AB. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# SPDX-License-Identifier: BSD-2-Clause

name: alpine

on:
  pull_request:
    branches:
    - main
  push:
    branches:
    - main
    - '*-ci'

jobs:
  build:
    runs-on: ubuntu-24.04
    container: alpine:latest
    strategy:
      fail-fast: false
      matrix:
        cc: [ gcc, clang ]
    steps:
    - name: dependencies
      run: |
        apk -q update
        apk add build-base clang clang-analyzer cmake coreutils eudev-dev
        apk add git linux-headers openssl-dev sudo zlib-dev pcsc-lite-dev \
          libcbor-dev
    - name: fix permissions on workdir
      run: chown root:wheel "${GITHUB_WORKSPACE}"
    - name: checkout libfido2
      uses: actions/checkout@v4
    - name: build libfido2
      env:
        CC: ${{ matrix.cc }}
      run: ./.actions/build-linux-${CC}
