|
| 1 | +name: Build for arm ubuntu |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags: |
| 8 | + - uuu* |
| 9 | + pull_request: |
| 10 | + types: |
| 11 | + - opened |
| 12 | + - synchronize |
| 13 | + |
| 14 | +jobs: |
| 15 | + build_job: |
| 16 | + # The host should always be linux |
| 17 | + runs-on: ubuntu-latest |
| 18 | + name: Build on ${{ matrix.distro }} ${{ matrix.arch }} |
| 19 | + |
| 20 | + # Run steps on a matrix of 4 arch/distro combinations |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + include: |
| 24 | + - arch: aarch64 |
| 25 | + distro: ubuntu20.04 |
| 26 | + - arch: armv7 |
| 27 | + distro: ubuntu20.04 |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v3 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + |
| 34 | + - uses: uraimo/run-on-arch-action@v2 |
| 35 | + name: Build artifact |
| 36 | + id: build |
| 37 | + with: |
| 38 | + arch: ${{ matrix.arch }} |
| 39 | + distro: ${{ matrix.distro }} |
| 40 | + |
| 41 | + # Not required, but speeds up builds |
| 42 | + githubToken: ${{ github.token }} |
| 43 | + |
| 44 | + # Mount the artifacts directory as /artifacts in the container |
| 45 | + dockerRunArgs: | |
| 46 | + --volume "${PWD}:/mfgtools" |
| 47 | +
|
| 48 | + # Pass some environment variables to the container |
| 49 | + env: | # YAML, but pipe character is necessary |
| 50 | + artifact_name: git-${{ matrix.distro }}_${{ matrix.arch }} |
| 51 | +
|
| 52 | + # The shell to run commands with in the container |
| 53 | + shell: /bin/sh |
| 54 | + |
| 55 | + # Install some dependencies in the container. This speeds up builds if |
| 56 | + # you are also using githubToken. Any dependencies installed here will |
| 57 | + # be part of the container image that gets cached, so subsequent |
| 58 | + # builds don't have to re-install them. The image layer is cached |
| 59 | + # publicly in your project's package repository, so it is vital that |
| 60 | + # no secrets are present in the container state or logs. |
| 61 | + install: | |
| 62 | + apt-get update -q -y |
| 63 | + apt-get install -q -y libusb-1.0-0-dev libbz2-dev libzstd-dev pkg-config cmake libssl-dev g++ zlib1g-dev git |
| 64 | +
|
| 65 | + # Produce a binary artifact and place it in the mounted volume |
| 66 | + run: | |
| 67 | + git config --global --add safe.directory /mfgtools |
| 68 | + cd /mfgtools |
| 69 | + cmake . |
| 70 | + make |
| 71 | +
|
| 72 | + - name: Rename |
| 73 | + run: cp uuu/uuu uuu_${{ matrix.arch }} |
| 74 | + |
| 75 | + - name: Upload Build Artifacts |
| 76 | + uses: actions/upload-artifact@v3 |
| 77 | + with: |
| 78 | + name: uuu_${{ matrix.arch }} |
| 79 | + path: uuu_${{ matrix.arch }} |
| 80 | + |
| 81 | + - name: Create or Update Release |
| 82 | + uses: ncipollo/release-action@v1 |
| 83 | + with: |
| 84 | + name: Release ${{ github.ref_name }} |
| 85 | + tag: ${{ github.ref_name }} |
| 86 | + commit: ${{ github.sha }} |
| 87 | + allowUpdates: true |
| 88 | + prerelease: true |
| 89 | + artifacts: "uuu_${{ matrix.arch }}" |
| 90 | + |
0 commit comments