Skip to content

Commit

Permalink
Added reusable workflows
Browse files Browse the repository at this point in the history
Added a clean pull which provides the SHA and SHA7 of the current branch
Added a build target for any platform or targets
  • Loading branch information
joshlafleur-zip committed Mar 9, 2025
1 parent f6e107f commit cb645a7
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/reusable/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Platform and Archive

on:
workflow_dispatch:
inputs:
platform:
required: true
type: string
flags:
default: "-j32"
type: string
build-type:
required: true
options:
- platform
- targets
outputs:
build-artifacts-link:
description: "The link to the github archive of the build artifacts"
value: ${{ jobs.run.outputs.archive-url }}
sha:
description: "The current branch's SHA"
value: ${{ jobs.run.outputs.sha }}
short-sha:
description: "The current branch's short (7) SHA"
value: ${{ jobs.run.outputs.short-sha }}

jobs:
run:
runs-on: self-hosted
container:
image: docker://ghcr.io/concordia-fsae/containers/ubuntu-noble-lts:v1.0.0
outputs:
archive-url: ${{ steps.archive.outputs.archive-url }}
sha: ${{ steps.pull.outputs.sha }}
short-sha: ${{ steps.pull.outputs.short-sha }}
steps:
- name: Get Clean Branch
id: pull
uses: concordia-fsae/firmware/.github/workflows/reusable/clean_pull.yml@main
- name: Build Platform ${{ inputs.platform }}
id: build
run: |
scons --${{ inputs.build-type }}=${{ inputs.platform }} ${{ inputs.flags }}
- name: Archive Artifacts
id: archive
uses: actions/upload-artifact@v4
with:
name: artifacts
path: platform-artifacts/

31 changes: 31 additions & 0 deletions .github/workflows/reusable/clean_pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Clean Working dir, Pull Current Branch, and Retrive Branch Metadata

on:
workflow_dispatch:
outputs:
sha:
description: "The current branch's SHA"
value: ${{ jobs.run.outputs.sha }}
short-sha:
description: "The current branch's short (7) SHA"
value: ${{ jobs.run.outputs.short-sha }}

jobs:
run:
outputs:
sha: ${{ steps.sha.outputs.sha }}
short-sha: ${{ steps.sha.outputs.short-sha }}
steps:
- name: Clean
uses: AutoModality/action-clean@1077775f5ef0022fc3a9d6f93377921ea3701fa7
- name: Pull Branch
uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: 'true'
submodules: 'recursive'
- name: Get SHA and SHA7
id: sha
run: |
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT && \
echo "short-sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

0 comments on commit cb645a7

Please sign in to comment.