Skip to content

Commit

Permalink
Build and release libraries in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Fasano committed Dec 15, 2023
1 parent c9fb0c0 commit 81b0137
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Compile and publish libnvram

on:
push:
branches:
- master

jobs:
build:
runs-on: panda-arc

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build
run: |
docker run --rm -v $PWD:/app -w /app ghcr.io/panda-re/embedded-toolchains_rust:latest /app/package.sh
- name: Save package
uses: actions/upload-artifact@v3
with:
name: libnvram-latest.tar.gz
path: libnvram-latest.tar.gz

- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release_${{ github.sha }}
release_name: Release ${{ github.ref }}
body: |
Release @${{ github.ref }}
draft: true
prerelease: false
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./libnvram-latest.tar.gz
asset_name: libnvram-latest.tar.gz
asset_content_type: application/gzip
- name: Publish release
uses: StuYarrow/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ steps.create_release.outputs.id }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libnvram.tar.gz
25 changes: 25 additions & 0 deletions package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -eux

# Host is mapped at /app

rm -rf /app/out
mkdir /app/out

SCRATCH=$(mktemp -d)/libnvram
mkdir $SCRATCH

CC=arm-linux-musleabi-gcc make libnvram.so -C /app
mv libnvram.so $SCRATCH/libnvram.so.arm
make clean

CC=mipsel-linux-musl-gcc make libnvram.so -C /app
mv libnvram.so $SCRATCH/libnvram.so.mipsel
make clean

CC=mipseb-linux-musl-gcc make libnvram.so -C /app
mv libnvram.so $SCRATCH/libnvram.so.mipseb
make clean

tar -czvf /app/libnvram-latest.tar.gz -C $(dirname $SCRATCH) libnvram
rm -rf /app/out

0 comments on commit 81b0137

Please sign in to comment.