|
| 1 | +name: Arduino-Temperature-Control-Library Github Workflow |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + test: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v3 |
| 10 | + |
| 11 | + - name: Install AVR dependencies |
| 12 | + run: | |
| 13 | + sudo apt-get update |
| 14 | + sudo apt-get install -y gcc-avr avr-libc |
| 15 | +
|
| 16 | + - name: Create required directories |
| 17 | + run: | |
| 18 | + mkdir -p $GITHUB_WORKSPACE/libraries |
| 19 | + mkdir -p $GITHUB_WORKSPACE/.arduino15 |
| 20 | + mkdir -p $GITHUB_WORKSPACE/Arduino |
| 21 | +
|
| 22 | + - name: Setup Arduino CLI |
| 23 | + uses: arduino/setup-arduino-cli@v1 |
| 24 | + |
| 25 | + - name: Configure Arduino CLI and install cores |
| 26 | + run: | |
| 27 | + arduino-cli config init |
| 28 | + arduino-cli config set library.enable_unsafe_install true |
| 29 | + arduino-cli config add board_manager.additional_urls https://arduino.esp8266.com/stable/package_esp8266com_index.json |
| 30 | + arduino-cli core update-index |
| 31 | + arduino-cli core install arduino:avr |
| 32 | + arduino-cli core install esp8266:esp8266 |
| 33 | +
|
| 34 | + - name: Install OneWire library |
| 35 | + run: | |
| 36 | + arduino-cli lib install OneWire |
| 37 | + # Replace the CRC implementation directly in the OneWire library |
| 38 | + cat > /home/runner/Arduino/libraries/OneWire/util/crc16.h << 'EOF' |
| 39 | + #ifndef CRC16_H |
| 40 | + #define CRC16_H |
| 41 | + #include <stdint.h> |
| 42 | +
|
| 43 | + static inline uint16_t _crc16_update(uint16_t crc, uint8_t a) |
| 44 | + { |
| 45 | + crc ^= a; |
| 46 | + for (uint8_t i = 0; i < 8; ++i) { |
| 47 | + if (crc & 1) |
| 48 | + crc = (crc >> 1) ^ 0xA001; |
| 49 | + else |
| 50 | + crc = (crc >> 1); |
| 51 | + } |
| 52 | + return crc; |
| 53 | + } |
| 54 | +
|
| 55 | + #endif |
| 56 | + EOF |
| 57 | +
|
| 58 | + - name: Set up Ruby |
| 59 | + uses: ruby/setup-ruby@v1 |
| 60 | + with: |
| 61 | + ruby-version: '3.2.0' |
| 62 | + |
| 63 | + - name: Install bundler |
| 64 | + run: | |
| 65 | + gem install bundler |
| 66 | +
|
| 67 | + - name: Install dependencies |
| 68 | + run: | |
| 69 | + bundle install |
| 70 | +
|
| 71 | + - name: List repository contents (for debugging) |
| 72 | + run: | |
| 73 | + ls -R |
| 74 | +
|
| 75 | + - name: Remove Blacklisted Example Sketches |
| 76 | + run: | |
| 77 | + echo "Removing blacklisted example sketches..." |
| 78 | + rm -f examples/ESP-WebServer/ESP-WebServer.ino |
| 79 | +
|
| 80 | + - name: Run tests |
| 81 | + run: | |
| 82 | + bundle exec arduino_ci.rb |
0 commit comments