Skip to content

larger max file limit #291

larger max file limit

larger max file limit #291

name: build-and-publish
on:
push:
branches:
- "*"
tags:
- "v*"
jobs:
srv-test-and-docs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/beetle-srv
steps:
- uses: actions/checkout@v3
- name: "set output: short_sha"
id: vars
run: |
echo "SHORT_SHA=$(echo $GITHUB_SHA | head -c 7)">>$GITHUB_OUTPUT
- name: "(srv-test) install clippy"
run: rustup component add clippy
- name: "(srv-test) build"
run: cargo build -p beetle-srv
- name: "(srv-test) clippy"
run: cargo clippy -p beetle-srv
- name: "(srv-test) test"
run: cargo test -p beetle-srv
- name: "(srv-test) doc"
run: cargo doc --document-private-items -p beetle-srv
- name: "(srv-test) bundle: prepare"
run: mkdir -p beetle-srv-docs
- name: "(srv-test) bundle: copy"
run: cp -rv $GITHUB_WORKSPACE/target/doc beetle-srv-docs
- name: "(srv-test) bundle: create"
run: tar cvzf beetle-srv-docs-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz beetle-srv-docs
- uses: actions/upload-artifact@v3
with:
name: "beetle-srv-docs-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
path: "./src/beetle-srv/beetle-srv-docs-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
pio-build:
runs-on: ubuntu-latest
env:
BEETLE_GPG_KEY: "${{ secrets.BEETLE_CI_GPG }}"
BEETLE_GPG_KEY_ID: "${{ secrets.BEETLE_CI_GPG_KEY_ID }}"
REDIS_HOST: "${{ secrets.PIO_REDIS_HOST }}"
REDIS_PORT: "${{ secrets.PIO_REDIS_PORT }}"
REDIS_AUTH_USERNAME: "${{ secrets.PIO_REDIS_AUTH_USERNAME }}"
REDIS_AUTH_PASSWORD: "${{ secrets.PIO_REDIS_AUTH_PASSWORD }}"
DISTRIBUTABLE_DIRECTORY_NAME: "beetle-pio-dist"
defaults:
run:
working-directory: src/beetle-pio
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: "set output: short_sha"
id: vars
run: |
echo "SHORT_SHA=$(echo $GITHUB_SHA | head -c 7)">>$GITHUB_OUTPUT
- name: "import gpg"
run: |
echo "${{ secrets.BEETLE_CI_GPG }}" > orient-beetle-ci.key
gpg --import orient-beetle-ci.key
rm orient-beetle-ci.key
- name: "pip: upgrade"
run: python -m pip install --upgrade pip
- name: "pip: install pio"
run: pip install --upgrade platformio
- name: "env prep: fill redis ca"
run: echo $REDIS_HOST_ROOT_CA > embeds/redis_host_root_ca.pem
- name: "pio: check"
run: pio check
- name: "pio(xiao): upgrade"
run: pio upgrade
- name: "pio(xiao): pkg update"
run: pio pkg update
- name: "pio(xiao): run xiao"
run: pio run -e xiao
- name: "bundle(xiao): prepare-dir"
run: mkdir -p $DISTRIBUTABLE_DIRECTORY_NAME/xiao
- name: "bundle(xiao): copy-bin"
run: |
gpg --trust-model always -e -r $BEETLE_GPG_KEY_ID -o \
$DISTRIBUTABLE_DIRECTORY_NAME/xiao/firmware.bin.pgp \
.pio/build/xiao/firmware.bin
- name: "bundle(xiao): copy-map"
run: |
gpg --trust-model always -e -r $BEETLE_GPG_KEY_ID -o \
$DISTRIBUTABLE_DIRECTORY_NAME/xiao/firmware.map.pgp \
.pio/build/xiao/firmware.map
- name: "bundle(xiao): copy-elf"
run: |
gpg --trust-model always -e -r $BEETLE_GPG_KEY_ID -o \
$DISTRIBUTABLE_DIRECTORY_NAME/xiao/firmware.elf.pgp \
.pio/build/xiao/firmware.elf
- name: "bundle(xiao): copy-partitions"
run: |
gpg --trust-model always -e -r $BEETLE_GPG_KEY_ID -o \
$DISTRIBUTABLE_DIRECTORY_NAME/xiao/partitions.bin.pgp \
.pio/build/xiao/partitions.bin
- name: "bundle(xiao): copy-apploader"
run: |
ls -lah $HOME/.platformio
ls -lah $HOME/.platformio/packages/
ls -lah $HOME/.platformio/packages/framework-arduinoespressif32
ls -lah $HOME/.platformio/packages/framework-arduinoespressif32/tools
ls -lah $HOME/.platformio/packages/framework-arduinoespressif32/tools/partitions
gpg --trust-model always -e -r $BEETLE_GPG_KEY_ID -o \
$DISTRIBUTABLE_DIRECTORY_NAME/xiao/boot_app0.bin.pgp \
$HOME/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin
- name: "bundle: copy instruction"
run: |
cp -v $GITHUB_WORKSPACE/.automation/firmware-instructions/flashing-xiao.txt \
$DISTRIBUTABLE_DIRECTORY_NAME
- name: "bundle: create"
run: tar cvzf beetle-pio-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz $DISTRIBUTABLE_DIRECTORY_NAME
- uses: actions/upload-artifact@v3
with:
name: "beetle-pio-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
path: "./src/beetle-pio/beetle-pio-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
ui-build:
runs-on: ubuntu-latest
env:
BEETLE_VERSION: "${{ github.sha }}"
# note: These are specific paths related to nginx hosting config. When developing locally,
# it is more likely you will be serving from a root `/`.
BEETLE_UI_ROOT: ${{ secrets.BEETLE_UI_ROOT }}
BEETLE_API_ROOT: ${{ secrets.BEETLE_API_ROOT }}
BEETLE_LOGIN_URL: ${{ secrets.BEETLE_LOGIN_URL }}
BEETLE_LOGOUT_URL: ${{ secrets.BEETLE_LOGOUT_URL }}
defaults:
run:
working-directory: src/beetle-ui
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: "set output: short_sha"
id: vars
run: |
echo "SHORT_SHA=$(echo $GITHUB_SHA | head -c 7)">>$GITHUB_OUTPUT
- name: "install elm: download"
run: curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz
- name: "install elm: unpack"
run: gunzip elm.gz && chmod +x elm
- name: "install elm: install"
run: sudo mv elm /usr/local/bin/
- name: "install elm: verison"
run: elm --version
- name: "install node-deps"
run: npm i
- name: "lint: ts"
run: npm run lint:ts
- name: "lint: elm"
run: npm run lint:elm -- --validate
- name: "make: release"
run: make release
- name: "bundle: prepare"
run: mv target/release beetle-ui-dist
- name: "bundle: create"
run: tar cvzf beetle-ui-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz beetle-ui-dist
- uses: actions/upload-artifact@v3
with:
name: "beetle-ui-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
path: "./src/beetle-ui/beetle-ui-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
srv-osx-build:
if: startsWith(github.ref, 'refs/tags/')
runs-on: macos-12
env:
BEETLE_VERSION: "${{ github.sha }}"
defaults:
run:
working-directory: src/beetle-srv
steps:
- uses: actions/checkout@v3
- name: "set output: short_sha"
id: vars
run: |
echo "SHORT_SHA=$(echo $GITHUB_SHA | head -c 7)">>$GITHUB_OUTPUT
- name: "build"
run: cargo build --release -p beetle-srv
- name: "bundle: prepare"
run: mkdir -p beetle-server-dist/bin
- name: "bundle: cli"
run: cp $GITHUB_WORKSPACE/target/release/beetle-cli beetle-server-dist/bin/beetle-cli
- name: "bundle: create"
run: tar cvzf beetle-server-osx-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz beetle-server-dist
- uses: actions/upload-artifact@v3
with:
name: "beetle-server-osx-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
path: "./src/beetle-srv/beetle-server-osx-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
srv-armv7-build:
runs-on: ubuntu-latest
env:
BEETLE_VERSION: "${{ github.sha }}"
DISTRIBUTABLE_DIRECTORY_NAME: "beetle-server-dist"
container:
image: dadleyy/rust-raspberry-pi-openssl:latest
defaults:
run:
working-directory: src/beetle-srv
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: "set output: short_sha"
id: vars
run: |
echo "SHORT_SHA=$(echo $GITHUB_SHA | head -c 7)">>$GITHUB_OUTPUT
- name: "cargo: build"
run: cargo build --target armv7-unknown-linux-gnueabihf --release -p beetle-srv
env:
OPENSSL_LIB_DIR: /tmp/openssl-1.1.1g/
OPENSSL_INCLUDE_DIR: /tmp/openssl-1.1.1g/include
- name: "bundle"
run: |
$GITHUB_WORKSPACE/.automation/bundle-srv.sh \
beetle-server-armv7-unknown-linux-gnueabihf-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz \
$DISTRIBUTABLE_DIRECTORY_NAME \
armv7-unknown-linux-gnueabihf
- uses: actions/upload-artifact@v3
with:
name: "beetle-server-armv7-unknown-linux-gnueabihf-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
path: "./src/beetle-srv/beetle-server-armv7-unknown-linux-gnueabihf-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
srv-x86-build:
runs-on: ubuntu-latest
container:
image: rust:1-bullseye
env:
BEETLE_VERSION: "${{ github.sha }}"
DISTRIBUTABLE_DIRECTORY_NAME: "beetle-server-dist"
defaults:
run:
working-directory: src/beetle-srv
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: "set output: short_sha"
id: vars
run: |
echo "SHORT_SHA=$(echo $GITHUB_SHA | head -c 7)">>$GITHUB_OUTPUT
- name: "build"
run: cargo build --target x86_64-unknown-linux-gnu --release -p beetle-srv
- name: "bundle"
run: |
$GITHUB_WORKSPACE/.automation/bundle-srv.sh \
beetle-server-x86-unknown-linux-gnu-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz \
$DISTRIBUTABLE_DIRECTORY_NAME \
x86_64-unknown-linux-gnu
- uses: actions/upload-artifact@v3
with:
name: "beetle-server-x86-unknown-linux-gnu-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
path: "./src/beetle-srv/beetle-server-x86-unknown-linux-gnu-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
publish:
runs-on: ubuntu-latest
needs: ["srv-armv7-build", "srv-x86-build", "ui-build", "pio-build", "srv-test-and-docs"]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
steps:
- uses: actions/checkout@v3
- name: "set output: short_sha"
id: vars
run: |
echo "SHORT_SHA=$(echo $GITHUB_SHA | head -c 7)">>$GITHUB_OUTPUT
- uses: actions/download-artifact@v3
with:
name: "beetle-server-x86-unknown-linux-gnu-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
- uses: actions/download-artifact@v3
with:
name: "beetle-srv-docs-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
- uses: actions/download-artifact@v3
with:
name: "beetle-server-armv7-unknown-linux-gnueabihf-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
- uses: actions/download-artifact@v3
with:
name: "beetle-ui-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
- uses: actions/download-artifact@v3
with:
name: "beetle-pio-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
- name: "(aws) upload all artifacts"
run: |
mkdir -p _awscli-download
pushd _awscli-download
cp -v _awscli-cache/awscliv2.zip awscliv2.zip || \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
mkdir -p _awscli-cache
cp awscliv2.zip _awscli-cache/awscliv2.zip
unzip -q awscliv2.zip
./aws/dist/aws --version
./aws/dist/aws s3 ls s3://${{ secrets.AWS_BUCKET_NAME }}/orient-beetle || echo "empty"
arm_artifact="beetle-server-armv7-unknown-linux-gnueabihf-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
x86_artifact="beetle-server-x86-unknown-linux-gnu-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
ui_artifact="beetle-ui-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
docs_artifact="beetle-srv-docs-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"
./aws/dist/aws s3 cp \
../$docs_artifact \
s3://${{ secrets.AWS_BUCKET_NAME }}/orient-beetle/${{ steps.vars.outputs.SHORT_SHA }}/$docs_artifact
./aws/dist/aws s3 cp \
../$arm_artifact \
s3://${{ secrets.AWS_BUCKET_NAME }}/orient-beetle/${{ steps.vars.outputs.SHORT_SHA }}/$arm_artifact
./aws/dist/aws s3 cp \
../$x86_artifact \
s3://${{ secrets.AWS_BUCKET_NAME }}/orient-beetle/${{ steps.vars.outputs.SHORT_SHA }}/$x86_artifact
./aws/dist/aws s3 cp \
../$ui_artifact \
s3://${{ secrets.AWS_BUCKET_NAME }}/orient-beetle/${{ steps.vars.outputs.SHORT_SHA }}/$ui_artifact
popd
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: "./*.tar.gz"
generate_release_notes: true
body_path: ${{ github.workspace }}/.automation/release-body.md