Skip to content

Commit

Permalink
simplify matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Apr 19, 2024
1 parent 959f151 commit fea4002
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,26 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
platform:
- target: aarch64-unknown-linux-gnu
docker: linux/arm64
- target: x86_64-unknown-linux-gnu
docker: linux/amd64
image:
- name: relay
- name: relay-pop
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
image_name: [relay, relay-pop]

name: Build Relay Binary
runs-on: ubuntu-latest

if: "!startsWith(github.ref, 'refs/heads/release-library/')"

env:
RELAY_BIN: "target/${{ matrix.platform.target }}/release/relay"
RELAY_BIN: "target/${{ matrix.target }}/release/relay"
FEATURES: |
{
${{fromJson('{
"relay": "processing,crash-handler",
"relay-pop": "crash-handler"
}
}')[matrix.image_name] }}
DOCKER_PLATFORM: |
${{fromJson('{
"x86_64-unknown-linux-gnu": "linux/amd64",
"aarch64-unknown-linux-gnu": "linux/arm64"
}')[matrix.image_name] }}
steps:
- name: Install dependencies
Expand All @@ -218,7 +217,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@v2
with:
key: "${{ github.job }}-${{ matrix.platform.target }}-${{ matrix.image.name }}"
key: "${{ github.job }}-${{ matrix.target }}-${{ matrix.image_name }}"

- name: Install Cross
# We need a nightly version of cross for `cross-util`.
Expand All @@ -228,27 +227,27 @@ jobs:
run: |
export PATH="/home/runner/.cargo/bin/:$PATH"
cross build --release --locked --features "${{ fromJson(env.FEATURES)[matrix.image.name] }}" --target "${{ matrix.platform.target }}"
cross build --release --locked --features "${FEATURES}" --target "${{ matrix.target }}"
- name: Split debug info
run: |
llvm-objcopy --only-keep-debug "${RELAY_BIN}"{,.debug}
llvm-objcopy --strip-debug --strip-unneeded "${RELAY_BIN}"
llvm-objcopy --add-gnu-debuglink "${RELAY_BIN}"{.debug,}
cross-util run --target "${{ matrix.platform.target }}" -- "sentry-cli difutil bundle-sources ${RELAY_BIN}.debug"
cross-util run --target "${{ matrix.target }}" -- "sentry-cli difutil bundle-sources ${RELAY_BIN}.debug"
zip "${RELAY_BIN}.debug.zip" "${RELAY_BIN}.debug"
- name: Prepare Artifacts
run: |
mkdir -p "artifacts/${{ matrix.platform.docker }}"
cp "${RELAY_BIN}"{,.debug.zip,.src.zip} "artifacts/${{ matrix.platform.docker }}"
mkdir -p "artifacts/${DOCKER_PLATFORM}"
cp "${RELAY_BIN}"{,.debug.zip,.src.zip} "artifacts/${DOCKER_PLATFORM}"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ${{ matrix.image.name }}@${{ matrix.platform.target }}
name: ${{ matrix.image_name }}@${{ matrix.target }}
path: "./artifacts/*"

build-docker:
Expand Down

0 comments on commit fea4002

Please sign in to comment.