# minimal GitHub CI building UPX with clang and gcc in an Alpine Linux container

name: 'CI - Minimal CI with Alpine Linux'

on: { workflow_dispatch: }
jobs:
  job-alpine-cmake:
    strategy: {matrix: {container: ['alpine:3.12','alpine:3.17','alpine:edge']}}
    name: ${{ format('container {0}', matrix.container) }}
    runs-on: ubuntu-latest
    container: ${{ matrix.container }}
    steps:
      - name: ${{ format('Install packages {0}', matrix.container) }}
        run: 'apk update && apk upgrade && apk add bash clang cmake g++ git make'
      - name: 'Check out code'
        run: |
          git clone --branch devel --depth 1 https://github.com/upx/upx
          git -C upx submodule update --init
          echo "artifact_name=upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-minimal-ci-${{ matrix.container }}" | sed 's/:/-/g' >> $GITHUB_ENV
      - { name: 'Build clang', run: 'make -C upx build/extra/clang/release' }
      - { name: 'Build gcc',   run: 'make -C upx build/extra/gcc/release' }
      - name: ${{ format('Upload artifact {0}', env.artifact_name) }}
        uses: actions/upload-artifact@v3
        with:
          name: ${{ env.artifact_name }}
          path: 'upx*/build/*/*/*/upx'
      - { name: 'Run basic tests clang', run: 'make -C upx/build/extra/clang/release test' }
      - { name: 'Run basic tests gcc',   run: 'make -C upx/build/extra/gcc/release test' }
