From b900701b8fb95251b3a733bbc47bc2a96a042fe9 Mon Sep 17 00:00:00 2001 From: javalsai Date: Tue, 20 Aug 2024 23:56:54 +0200 Subject: [PATCH] feat(ci): add nicer workflows between all those changes, now x64 builds should be produced --- .github/workflows/build-check.yml | 15 ++++++++++ .github/workflows/build.yml | 47 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 30 ++++++++++++-------- 3 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build-check.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml new file mode 100644 index 0000000..776ce04 --- /dev/null +++ b/.github/workflows/build-check.yml @@ -0,0 +1,15 @@ +name: Test Build + +on: + push: + branches: + - '*' + pull_request: + branches: + - main + +jobs: + check_build: + runs-on: ubuntu-latest + steps: + - uses: ./.github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..21d11ed --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: Build Project + +on: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - arch_name: x86_64 + cc: gcc + cflags: + - arch_name: x64 + cc: gcc + cflags: -m32 + + steps: + - uses: actions/checkout@v4 + - uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libpam0g-dev + version: 1.0 + + - name: Build Code + run: | + make CC=${{ matrix.cc }} CFLAGS="-O3 ${{ cflags }}" + mv lidm lidm-${{ matrix.arch_name }} + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: build-${{ matrix.arch_name }} + path: lidm-${{ matrix.arch_name }} + + merge-builds: + runs-on: ubuntu-latest + needs: build + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@v4 + with: + name: all-builds + pattern: build-* + delete-merged: true + retention-days: 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c491add..736afbc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: C Make +name: Build for Release on: release: @@ -10,14 +10,20 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Install deps - run: sudo apt-get install -y libpam0g-dev - - name: make - run: make - - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: lidm - asset_name: lidm-x86_64 # will compile for more archs other day - tag: ${{ github.ref }} + - name: Build Project + uses: ./.github/workflows/build.yml + + - uses: actions/download-artifact@v4 + with: + name: all-builds + path: builds + + - name: Upload Builds to Release + run: | + cd builds + for file in ./*; do + echo "Uploading $file..." + gh release upload ${{ github.event.release.tag_name }} "$file" --clobber + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}