From e66c7736c6b5b5c997c54218ceca3fe67f891726 Mon Sep 17 00:00:00 2001 From: Cerul Alain Date: Wed, 14 Apr 2021 17:15:05 -0400 Subject: [PATCH] Add GitHub Workflow for Linux (attempt MacOS) This triggers a GitHub Action that gets the dependencies for avr-gcc (and also freeglut) in order to run the `make` on Linux. After the make is complete, it runs the suggested test command from the README.md. Currently this demonstrates that the output does not match what is stated. This could be evolved into a test that uses the continuous integration to enforce that the README.md output stays in sync with the actual program output. It includes an attempt to build on a Mac container. It gets an error of "fatal: No names found, cannot describe anything"...which someone familiar with MacOS who has seen a successful build would be more qualified to try and fix than I would be. --- .github/workflows/simavr-build.yml | 113 +++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 .github/workflows/simavr-build.yml diff --git a/.github/workflows/simavr-build.yml b/.github/workflows/simavr-build.yml new file mode 100644 index 000000000..0770adb84 --- /dev/null +++ b/.github/workflows/simavr-build.yml @@ -0,0 +1,113 @@ +# +# simavr-build.yml +# +# This will build simavr. It also checks to be sure that the sample from the +# README.md has the expected output. +# + +name: Simavr Build + + +on: + push: + branches: [ + master, + github-action + ] + pull_request: + branches: [ + master + ] + workflow_dispatch: # Allows running this workflow manually from Actions tab + + +# Standardize to use bash on all platforms. +# +defaults: + run: + shell: bash + + +# Each "Job" runs in its own VM, and a workflow run is made up of one or more +# jobs that can run sequentially or in parallel. +# +jobs: + avr-build: # Name of this workflow's only job + + strategy: # GitHub Matrix variables are `${{ matrix.xxx }}`, not `${xxx}` + matrix: + include: # put in order of visibility importance (shown in UI) + + - os: ubuntu-latest + + - os: macos-latest + + # https://github.com/actions/virtual-environments#available-environments + # + runs-on: ${{ matrix.os }} + + # You can put global environment variables here. + # + env: + SOME_ENVIRONMENT_VARIABLES: /you/can/set/them/here + + # Steps are a sequence of tasks that will be executed within a single VM + # as part of the job. + # + steps: # (no indentatation needed below; so indent the minimum!) + + + #====# CHECKOUT CODE #======================================================# + + # https://github.com/actions/checkout + # + - uses: actions/checkout@v2 + + + #====# INSTALL AVR CROSS COMPILER TOOLCHAIN #===============================# + + # Microchip.com has downloadable versions, e.g. for Windows: + # + # https://www.microchip.com/en-us/development-tools-tools-and-software/gcc-compilers-avr-and-arm + # + # Unfortunately those require a login and cookie to download. On Linux you + # can use `apt` and on MacOS you can use `brew` to get packaged variants. + + - name: Install AVR GCC Cross-Compiler and C Runtime Library (Linux) + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt install avr-libc + sudo apt install gcc-avr + sudo apt install libelf-dev + sudo apt install freeglut3-dev # for simduiono, ledramp + + - name: Install AVR GCC Cross-Compiler and C Runtime Library (MacOS) + if: matrix.os == 'macos-latest' + run: | + brew tap osx-cross/avr + # avr-libc is now included in avr-gcc + brew install avr-gcc avr-binutils + # brew install avrdude # package is available if needed + brew install freeglut # for simduino, ledramp + + - name: Check AVR-GCC is Working And Get Version Details + run: | + avr-gcc -v # -v gives compiler configuration details + + + #====# BUILD #==============================================================# + + - name: Build AVR Binary Products + run: | + make + + + #====# TEST #===============================================================# + + # Note: Ideally this would extract the actual claimed output from README.md + # with a command line utility, and then diff it. Then fail the test if + # the diff wasn't identical. For now, just inspect it. + # + - name: Test For Consistency With README.md + run: | + ./simavr/run_avr tests/atmega88_example.axf