Change project name and fix up GitHub CI/CD

This commit is contained in:
Keir Fraser
2021-12-26 12:14:30 +00:00
parent 554e078967
commit 0669e6c13a
8 changed files with 39 additions and 176 deletions

View File

@@ -25,103 +25,32 @@ jobs:
- name: Build dist
run: |
export VER=${{ steps.vars.outputs.sha_short }}
export P=greaseweazle-firmware
export V=${{ steps.vars.outputs.sha_short }}
make dist
mkdir -p _cidist
rm Greaseweazle-v*.zip
mv Greaseweazle-v* Greaseweazle-$VER
rm Greaseweazle-$VER/RELEASE_NOTES
git rev-parse HEAD >Greaseweazle-$VER/COMMIT
echo "commit = '$(git rev-parse HEAD)'" >>Greaseweazle-$VER/scripts/greaseweazle/version.py
zip -r Greaseweazle-$VER.zip Greaseweazle-$VER
mv Greaseweazle-$VER.zip _cidist/
rm $P-v*.zip
mv $P-v* $P-$V
rm $P-$V/RELEASE_NOTES
git rev-parse HEAD >$P-$V/COMMIT
zip -r $P-$V.zip $P-$V
mv $P-$V.zip _cidist/
- name: Build debug dist
run: |
export VER=${{ steps.vars.outputs.sha_short }}-debug
export P=greaseweazle-firmware
export V=${{ steps.vars.outputs.sha_short }}-debug
env debug=y make dist
rm Greaseweazle-v*.zip
mv Greaseweazle-v* Greaseweazle-$VER
rm Greaseweazle-$VER/RELEASE_NOTES
git rev-parse HEAD >Greaseweazle-$VER/COMMIT
echo debug >>Greaseweazle-$VER/COMMIT
echo "commit = '$(git rev-parse HEAD)'" >>Greaseweazle-$VER/scripts/greaseweazle/version.py
zip -r Greaseweazle-$VER.zip Greaseweazle-$VER
mv Greaseweazle-$VER.zip _cidist/
rm $P-v*.zip
mv $P-v* $P-$V
rm $P-$V/RELEASE_NOTES
git rev-parse HEAD >$P-$V/COMMIT
echo debug >>$P-$V/COMMIT
zip -r $P-$V.zip $P-$V
mv $P-$V.zip _cidist/
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.sha_short }}
name: greaseweazle-firmware.ci.${{ steps.vars.outputs.sha_short }}
path: _cidist
build-windows:
needs: build-ubuntu
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Set environment variables
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Download Ubuntu build
uses: actions/download-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.sha_short }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
architecture: x86
- name: Dependency packages (pip)
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --user bitarray crcmod pyserial cx_Freeze
- name: Build dist
run: |
make windist VER=${{ steps.vars.outputs.sha_short }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.sha_short }}
path: Greaseweazle-${{ steps.vars.outputs.sha_short }}-win.zip
finalise:
needs: build-windows
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set environment variables
id: vars
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.sha_short }}
- name: Remove 64-bit DLLS
run: |
export VER=${{ steps.vars.outputs.sha_short }}
unzip Greaseweazle-$VER-win.zip
find . -name 'api-ms-*' | xargs rm -f
find Greaseweazle-$VER/lib -name 'python*.dll' | xargs rm -f
find Greaseweazle-$VER/lib -name 'vcruntime140.dll' | xargs rm -f
rm Greaseweazle-$VER-win.zip
zip -r Greaseweazle-$VER-win.zip Greaseweazle-$VER
- name: Upload finalised artifacts
uses: actions/upload-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.sha_short }}
path: Greaseweazle-${{ steps.vars.outputs.sha_short }}-win.zip

View File

@@ -32,48 +32,11 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.ref }}
path: Greaseweazle-${{ steps.vars.outputs.ref }}.zip
build-windows:
needs: build-ubuntu
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Set environment variables
id: vars
run: |
echo "::set-output name=ref::$(echo ${{ github.ref }} | sed -e's#.*/##')"
- name: Download Ubuntu build
uses: actions/download-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.ref }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
architecture: x86
- name: Dependency packages (pip)
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --user bitarray crcmod pyserial cx_Freeze
- name: Build dist
run: make windist
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.ref }}
path: Greaseweazle-${{ steps.vars.outputs.ref }}-win.zip
name: greaseweazle-firmware.ci.${{ steps.vars.outputs.ref }}
path: greaseweazle-firmware-${{ steps.vars.outputs.ref }}.zip
finalise:
needs: build-windows
needs: build-ubuntu
runs-on: ubuntu-20.04
steps:
@@ -87,17 +50,7 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: Greaseweazle.CI.${{ steps.vars.outputs.ref }}
- name: Remove 64-bit DLLS
run: |
export VER=${{ steps.vars.outputs.ref }}
unzip Greaseweazle-$VER-win.zip
find . -name 'api-ms-*' | xargs rm -f
find Greaseweazle-$VER/lib -name 'python*.dll' | xargs rm -f
find Greaseweazle-$VER/lib -name 'vcruntime140.dll' | xargs rm -f
rm Greaseweazle-$VER-win.zip
zip -r Greaseweazle-$VER-win.zip Greaseweazle-$VER
name: greaseweazle-firmware.ci.${{ steps.vars.outputs.ref }}
- name: Create Release
id: create_release
@@ -106,27 +59,17 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.vars.outputs.ref }}
body: "[**Release Notes:**](https://github.com/keirf/greaseweazle/blob/master/RELEASE_NOTES)"
release_name: Greaseweazle Firmware ${{ steps.vars.outputs.ref }}
body: "[**Release Notes:**](https://github.com/keirf/greaseweazle-firmware/blob/master/RELEASE_NOTES)"
draft: false
prerelease: false
- name: Upload Release Asset (Windows)
- 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: Greaseweazle-${{ steps.vars.outputs.ref }}-win.zip
asset_name: Greaseweazle-${{ steps.vars.outputs.ref }}-win.zip
asset_content_type: application/zip
- name: Upload Release Asset (Other)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Greaseweazle-${{ steps.vars.outputs.ref }}.zip
asset_name: Greaseweazle-${{ steps.vars.outputs.ref }}.zip
asset_path: greaseweazle-firmware-${{ steps.vars.outputs.ref }}.zip
asset_name: greaseweazle-firmware-${{ steps.vars.outputs.ref }}.zip
asset_content_type: application/zip

6
.gitignore vendored
View File

@@ -7,14 +7,10 @@
*.hex
*.orig
*.rej
*.rld
*.upd
*.adf
*.hfe
*.ipf
*.scp
*.pyc
scripts/greaseweazle/version.py
scripts/greaseweazle/optimised/optimised*
scripts/c_ext/build/
Greaseweazle-*
greaseweazle-firmware-*

View File

@@ -14,23 +14,24 @@ $(TARGETS):
else
PROJ = Greaseweazle
PROJ = greaseweazle-firmware
VER := v$(FW_MAJOR).$(FW_MINOR)
SUBDIRS += src bootloader blinky_test
all:
$(MAKE) -C src -f $(ROOT)/Rules.mk $(PROJ).elf $(PROJ).bin $(PROJ).hex
$(MAKE) -C src -f $(ROOT)/Rules.mk \
greaseweazle.elf greaseweazle.bin greaseweazle.hex
$(MAKE) bootloader=y -C bootloader -f $(ROOT)/Rules.mk \
Bootloader.elf Bootloader.bin Bootloader.hex
srec_cat bootloader/Bootloader.hex -Intel src/$(PROJ).hex -Intel \
bootloader.elf bootloader.bin bootloader.hex
srec_cat bootloader/bootloader.hex -Intel src/greaseweazle.hex -Intel \
-o $(PROJ)-$(VER).hex -Intel
$(PYTHON) ./scripts/mk_update.py new $(PROJ)-$(VER).upd \
bootloader/Bootloader.bin src/$(PROJ).bin $(mcu)
bootloader/bootloader.bin src/greaseweazle.bin $(mcu)
blinky:
$(MAKE) debug=y mcu=stm32f1 -C blinky_test -f $(ROOT)/Rules.mk \
Blinky.elf Blinky.bin Blinky.hex
blinky.elf blinky.bin blinky.hex
clean::
rm -f *.hex *.upd
@@ -41,20 +42,20 @@ dist:
mkdir -p $(PROJ)-$(VER)/hex/alt
$(MAKE) clean
$(MAKE) mcu=stm32f1 all blinky
cp -a $(PROJ)-$(VER).hex $(PROJ)-$(VER)/hex/$(PROJ)-F1-$(VER).hex
cp -a $(PROJ)-$(VER).hex $(PROJ)-$(VER)/hex/$(PROJ)-f1-$(VER).hex
cp -a $(PROJ)-$(VER).upd $(PROJ)-$(VER)/$(PROJ)-$(VER).upd
cp -a blinky_test/Blinky.hex $(PROJ)-$(VER)/hex/alt/Blinky_Test-F1-$(VER).hex
cp -a blinky_test/blinky.hex $(PROJ)-$(VER)/hex/alt/blinky-test-f1-$(VER).hex
cp -a COPYING $(PROJ)-$(VER)/
cp -a README.md $(PROJ)-$(VER)/
cp -a RELEASE_NOTES $(PROJ)-$(VER)/
$(MAKE) clean
$(MAKE) mcu=stm32f7 all
cp -a $(PROJ)-$(VER).hex $(PROJ)-$(VER)/hex/$(PROJ)-F7-$(VER).hex
cp -a $(PROJ)-$(VER).hex $(PROJ)-$(VER)/hex/$(PROJ)-f7-$(VER).hex
$(PYTHON) ./scripts/mk_update.py cat $(PROJ)-$(VER)/$(PROJ)-$(VER).upd \
$(PROJ)-$(VER)/$(PROJ)-$(VER).upd $(PROJ)-$(VER).upd
$(MAKE) clean
$(MAKE) mcu=at32f4 all
cp -a $(PROJ)-$(VER).hex $(PROJ)-$(VER)/hex/$(PROJ)-AT32F4-$(VER).hex
cp -a $(PROJ)-$(VER).hex $(PROJ)-$(VER)/hex/$(PROJ)-at32f4-$(VER).hex
$(PYTHON) ./scripts/mk_update.py cat $(PROJ)-$(VER)/$(PROJ)-$(VER).upd \
$(PROJ)-$(VER)/$(PROJ)-$(VER).upd $(PROJ)-$(VER).upd
$(MAKE) clean

View File

@@ -3,15 +3,9 @@ CC = $(TOOL_PREFIX)gcc
OBJCOPY = $(TOOL_PREFIX)objcopy
LD = $(TOOL_PREFIX)ld
ifeq ($(OS), Windows_NT)
PYTHON = python
ZIP = "C:/Program Files/7-Zip/7z.exe" a
UNZIP = "C:/Program Files/7-Zip/7z.exe" x
else
PYTHON = python3
ZIP = zip -r
UNZIP = unzip
endif
ifneq ($(VERBOSE),1)
TOOL_PREFIX := @$(TOOL_PREFIX)