|
| 1 | +name: Build mpy-cross |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + cp-version: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + mpy-cross: ["static", "static-aarch64", "static-mingw", "static-raspbian"] |
| 17 | + env: |
| 18 | + CP_VERSION: ${{ inputs.cp-version }} |
| 19 | + EX_static-mingw: static.exe |
| 20 | + OS_static: linux-amd64 |
| 21 | + OS_static-aarch64: linux-aarch64 |
| 22 | + OS_static-mingw: windows |
| 23 | + OS_static-raspbian: linux-raspbian |
| 24 | + steps: |
| 25 | + - name: Set up repository |
| 26 | + uses: actions/checkout@v3 |
| 27 | + with: |
| 28 | + submodules: false |
| 29 | + fetch-depth: 1 |
| 30 | + |
| 31 | + - name: Set up python |
| 32 | + uses: actions/setup-python@v4 |
| 33 | + with: |
| 34 | + python-version: 3.x |
| 35 | + |
| 36 | + - name: Set up submodules |
| 37 | + uses: ./.github/actions/fetch_submodules |
| 38 | + with: |
| 39 | + target: mpy-cross |
| 40 | + |
| 41 | + - name: Install dependencies |
| 42 | + run: | |
| 43 | + sudo apt-get update |
| 44 | + sudo apt-get install -y gettext |
| 45 | +
|
| 46 | + - name: Install toolchain (aarch64) |
| 47 | + if: matrix.mpy-cross == 'static-aarch64' |
| 48 | + run: sudo apt-get install -y gcc-aarch64-linux-gnu |
| 49 | + |
| 50 | + - name: Install toolchain (mingw) |
| 51 | + if: matrix.mpy-cross == 'static-mingw' |
| 52 | + run: sudo apt-get install -y mingw-w64 |
| 53 | + |
| 54 | + - name: Build mpy-cross.${{ matrix.mpy-cross }} |
| 55 | + run: make -C mpy-cross -j2 -f Makefile.${{ matrix.mpy-cross }} |
| 56 | + |
| 57 | + - name: Upload artifact |
| 58 | + uses: actions/upload-artifact@v3 |
| 59 | + with: |
| 60 | + name: mpy-cross.${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }} |
| 61 | + path: mpy-cross/mpy-cross.${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }} |
| 62 | + |
| 63 | + - name: Upload to S3 |
| 64 | + if: >- |
| 65 | + (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || |
| 66 | + (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) |
| 67 | + env: |
| 68 | + AWS_PAGER: '' |
| 69 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 70 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 71 | + run: >- |
| 72 | + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp |
| 73 | + mpy-cross/mpy-cross.${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }} |
| 74 | + s3://adafruit-circuit-python/bin/mpy-cross/$OS_${{ matrix.mpy-cross }}/mpy-cross-$CP_VERSION.${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }} |
| 75 | + --no-progress --region us-east-1 |
0 commit comments