name: Backend PR on: workflow_call: workflow_dispatch: pull_request: branches: - master paths: - 'backend/**' - 'libs/**' jobs: libs: name: Build libs strategy: matrix: target: [amd64, arm64] include: - target: amd64 snapshot_command: ./build-v8-snapshot.sh artifact_name: js_snapshot artifact_path: libs/js_engine/src/artifacts/JS_SNAPSHOT.bin - target: arm64 snapshot_command: ./build-arm-v8-snapshot.sh artifact_name: arm_js_snapshot artifact_path: libs/js_engine/src/artifacts/ARM_JS_SNAPSHOT.bin runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-libs-${{ matrix.target }}-${{ hashFiles('libs/Cargo.lock') }} - name: Build v8 snapshot run: ${{ matrix.snapshot_command }} working-directory: libs - uses: actions/upload-artifact@v3 with: name: ${{ matrix.artifact_name }} path: ${{ matrix.artifact_path }} backend: name: Build backend runs-on: ubuntu-latest needs: libs steps: - uses: actions/checkout@v3 with: submodules: recursive - name: Download arm_js_snapshot artifact uses: actions/download-artifact@v3 with: name: arm_js_snapshot path: libs/js_engine/src/artifacts/ - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-backend-${{ hashFiles('backend/Cargo.lock') }} - name: Build backend run: make backend - name: 'Tar files to preserve file permissions' run: tar -cvf backend.tar backend/target/aarch64-unknown-linux-gnu/release/embassy* - uses: actions/upload-artifact@v3 with: name: backend path: backend.tar