The free services for Open Source projects by Travis-CI.org were terminated last summer. Since I had a lot of things to do in other projects I didn't "immediately" realize it. Instead of migrating to Travis-CI.com it made much more sense to move on to GitHub Actions, which, of course, required a bit of space in my brain for different concepts yet to be learned. Plenty of reasons to wait a bit longer...
OK, finally I did that step. It turned out that using a Docker container (with tool chain and µC emulator based test environment) for building and testing an embedded Forth was a very good choice. It "survived" hundreds of deployments, several major host OS and tool chain upgrades and when changing the CI provider (from Travis-CI to GitHub Actions) it was the least of my concerns.
All it takes (really!) is to add an Action file to .github/workflows. Building and testing STM8 eForth in a Docker container soon worked. The build steps for publishing binaries to GitHub Releases was a bit harder. Here is the result:
name: build-test
on: [push]
jobs:
Build-Test-Release:
runs-on: ubuntu-latest
container: tg9541/docker-sdcc:V3.9.0
steps:
- run: |
echo "triggered by: ${{ github.event_name }}"
echo "repository: ${{ github.repository }}"
echo "branch name: ${{ github.ref }}"
- name: Check out repository code
uses: actions/checkout@v2
- name: Build and test
run: |
echo "; ##########################################" >> forth.asm
echo "; # Release info added by GitHub action:" >> forth.asm
echo "; # repository: ${{ github.repository }}" >> forth.asm
echo "; # branch name: ${{ github.ref }}" >> forth.asm
echo "; # sha: ${{ github.sha }}" >> forth.asm
echo "; ##########################################" >> forth.asm
make BOARD=test forth
make clean
make all
echo "Job status: ${{ job.status }}."
- name: GH Release
uses: softprops/action-gh-release@v0.1.14
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
out/stm8ef-bin.zip
out/stm8ef-bin.tgz
out/stm8ef-rst.tgz
- name: Keep non-release binaries
uses: softprops/action-gh-release@v0.1.14
if: (! startsWith(github.ref, 'refs/tags/'))
with:
tag_name: volatile
files: |
out/stm8ef-bin.zip
out/stm8ef-bin.tgz
out/stm8ef-rst.tgz
I decided to use the plugin "GH Release" from the "Actions Marketplace" for publishing binaries to GitHub Releases. It's well maintained and has a good set of features. After I realized that I can use the publish step from inside a Docker container, publishing the STM8 eForth 2.2.29-pre1 worked like charm. Nice.
The step "Build and test" does the obvious but it also appends version information to the file forth.asm in the workspace. The reason for this is simply that I decided to upload binaries from any non-tag push to the default Git tag "volatile" - and after downloading a binary from the Volatile Release you might want to know what exactly you're looking at, e.g.:
; ##########################################
; # Release info added by GitHub action:
; # repository: TG9541/stm8ef
; # branch name: refs/heads/master
; # sha: 8ee3453ce577181ef5e9bddda94f56d448dbf962
; ##########################################
You can use the "sha" field to construct a GitHub URL to the precise version like this:
https://github.com/TG9541/stm8ef/commit/8ee3453ce577181ef5e9bddda94f56d448dbf962
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.