name: Build

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Install aria2
      run: sudo apt install aria2 -y

    - name: Install LLVM
      run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
    
    - name: Set up Android NDK r23b
      run: | 
        aria2c -o android-ndk-r23b-linux.zip https://dl.google.com/android/repository/android-ndk-r23b-linux.zip
        unzip -q -d ~ android-ndk-r23b-linux.zip
      
    - name: Build
      run: |
        mkdir build
        cd build
        cmake ..
        make

    - name: Set outputs
      id: vars
      run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

    - name: Upload artifact
      uses: actions/upload-artifact@v4
      with:
        name: Wrapper.x86_64.${{ steps.vars.outputs.sha_short }}
        include-hidden-files: true
        path: |
          rootfs
          wrapper
          Dockerfile
        

