Skip to content

Commit

Permalink
feat(ci): add nicer workflows
Browse files Browse the repository at this point in the history
between all those changes, now x64 builds should be produced
  • Loading branch information
javalsai committed Aug 20, 2024
1 parent ca95d39 commit b900701
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 12 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 18 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C Make
name: Build for Release

on:
release:
Expand All @@ -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 }}

1 comment on commit b900701

@javalsai
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was supposed to be on a workflow testing repo...

Please sign in to comment.