Skip to content

Commit

Permalink
GitHub cicd (#3)
Browse files Browse the repository at this point in the history
* CICD test

* make scripts executable

* Correct Docker Image

* Prevent Lunch Menu

* Add output.zip

* Correct file paths

* See where the files are

* Stop guesing

* Stop guesing2

* test dir

* Figure out Monkeybuisiness

* Do ls after build.sh

* ls in the wrong place

* ls in the wrong place

* Cleanup

* Fix update.img path

* Update README.md

---------

Co-authored-by: Alistair Jordan <alistairjordan>
  • Loading branch information
alistairjordan authored Nov 24, 2023
1 parent 3910a76 commit 6aa99de
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 1 deletion.
1 change: 1 addition & 0 deletions .BoardConfig.mk
46 changes: 46 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare build environment
run: ./cicd/prepare_runner.sh
- name: Build
run: ./cicd/docker_brun.sh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: Balloon${{ github.run_id }}${{ github.run_attempt }}
release_name: Release ${{ github.sha }}
body: |
Contents of this release:
* update.img - Update image for LuckyFox pico Board.
* output.zip - Contents of output folder
draft: true
prerelease: false
- name: Upload Release Asset update.img
id: upload-release-asset-update
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./output/image/update.img
asset_name: update.img
asset_content_type: application/img
- name: Upload Release Asset output.zip
id: upload-release-asset-output
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./output.zip
asset_name: output.zip
asset_content_type: application/zip

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# *.o
.BoardConfig.mk
RK-RELEASE-NOTES-V1.4.1.txt
IMAGE/
output/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ The initial prototype can be seen in the images below.
* It boots into linux and doesn't blow up.
* DTS Updated for correct pin attribution
* GPS Works
* CI/CD Works
* Lora works, LoraWan not
* Basically the entire code base is missing.
5 changes: 5 additions & 0 deletions cicd/docker_brun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set -e

sudo docker run --privileged --mount type=bind,source="$(pwd)",target=/balloon luckfoxtech/luckfox_pico:1.0 /bin/bash /balloon/build.sh

zip output.zip output
25 changes: 25 additions & 0 deletions cicd/prepare_runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set -e

# Install binfmt-support and zip
sudo apt install -y binfmt-support qemu-user-static zip

# Install docker
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Do submodule checkout
git submodule init
git submodule update --depth=1

0 comments on commit 6aa99de

Please sign in to comment.