Merge branch 'dev' of https://github.com/flipperdevices/video-game-mo… #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- dev | |
tags: | |
- '*' | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 'Wipe workspace' | |
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; | |
- name: 'Checkout code' | |
uses: actions/checkout@v4 | |
with: | |
submodules: false | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: 'Set toolchain envs' | |
run: | | |
echo "FBT_TOOLCHAIN_PATH=$(pwd)" >> $GITHUB_ENV | |
- name: 'Download toolchain' | |
run: | | |
source scripts/toolchain/fbtenv.sh | |
- name: 'Setup cmake' | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: '3.29.0' | |
- name: 'Checkout submodules' | |
run: git submodule update --init --recursive --depth 1 --jobs "$(getconf _NPROCESSORS_ONLN)"; | |
- name: 'Get commit details' | |
id: names | |
run: | | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
TYPE="pull" | |
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then | |
TYPE="tag" | |
else | |
TYPE="other" | |
fi | |
source scripts/toolchain/fbtenv.sh; | |
python3 scripts/get_env.py \ | |
"--event_file=${{ github.event_path }}" \ | |
"--type=$TYPE" \ | |
"--github_auth_token=${{ secrets.GITHUB_TOKEN }}"; | |
echo "event_type=$TYPE" >> $GITHUB_OUTPUT | |
- name: 'Build firmware' | |
run: | | |
source scripts/toolchain/fbtenv.sh; | |
pushd build; | |
cmake -DCMAKE_BUILD_TYPE=Release ../; | |
make -j"$(getconf _NPROCESSORS_ONLN)"; | |
popd; | |
- name: 'Make artifacts directory' | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
run: | | |
rm -rf artifacts; | |
mkdir artifacts; | |
- name: 'Move upload files' | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
run: | | |
mv build/app/firmware.elf artifacts/vgm-rp2040-firmware-${SUFFIX}.elf; | |
mv build/app/firmware.bin artifacts/vgm-rp2040-firmware-${SUFFIX}.bin; | |
mv build/app/firmware.uf2 artifacts/vgm-rp2040-firmware-${SUFFIX}.uf2; | |
mv build/app/firmware.elf.map artifacts/vgm-rp2040-firmware-${SUFFIX}.map; | |
- name: 'Upload artifacts to update server' | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
run: | | |
FILES=$(for CUR in $(ls artifacts/); do echo "-F files=@artifacts/$CUR"; done) | |
curl --fail -L -H "Token: ${{ secrets.INDEXER_TOKEN }}" \ | |
-F "branch=${BRANCH_NAME}" \ | |
${FILES[@]} \ | |
"${{ secrets.INDEXER_URL }}"/vgm-firmware/uploadfiles; |