Update Makefile #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: F3 CI/CD | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup environment | |
| shell: bash | |
| run: | | |
| case "${{ matrix.os }}" in | |
| windows-latest) | |
| # Установка Cygwin и зависимостей | |
| choco install cygwin -y --force | |
| export CYGWIN_ROOT="/cygdrive/c/cygwin" | |
| export PATH="$CYGWIN_ROOT/bin:$PATH" | |
| cyg-get.exe -P gcc-core make libargp-devel libparted-devel libudev-devel | |
| ;; | |
| ubuntu-latest) | |
| sudo apt-get update | |
| sudo apt-get install -y libudev-dev libparted-dev | |
| ;; | |
| macos-latest) | |
| brew update | |
| brew install argp-standalone parted | |
| ;; | |
| esac | |
| - name: Build all targets | |
| shell: bash | |
| env: | |
| ARGP_PATH: /usr/local | |
| CC: gcc | |
| run: | | |
| case "${{ matrix.os }}" in | |
| windows-latest) | |
| export ARGP_PATH="$CYGWIN_ROOT/usr/local" | |
| make CC="gcc" EXTRA_CFLAGS="-DWINDOWS_COMPAT" extra | |
| ;; | |
| *) | |
| make extra | |
| ;; | |
| esac | |
| - name: Collect artifacts | |
| shell: bash | |
| run: | | |
| mkdir -p artifacts | |
| case "${{ matrix.os }}" in | |
| windows-latest) | |
| cp *.exe artifacts/ | |
| ;; | |
| *) | |
| cp f3write f3read f3probe f3brew f3fix artifacts/ | |
| ;; | |
| esac | |
| - name: Upload binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: f3-${{ matrix.os }}-binaries | |
| path: artifacts/ | |
| if-no-files-found: error | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build Docker image | |
| run: | | |
| docker build -t f3 . | |
| - name: Extract Docker artifacts | |
| run: | | |
| mkdir -p docker-artifacts | |
| docker run --rm -v $(pwd)/docker-artifacts:/out f3 bash -c "cp /usr/local/bin/f3* /out/" | |
| - name: Upload Docker artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-f3-binaries | |
| path: docker-artifacts/ |