Skip to content

Commit

Permalink
docker image, more platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Mar 15, 2024
1 parent 757d45a commit 4e044f3
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
50 changes: 42 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,22 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
target: [aarch64-unknown-linux-gnu]
platform:
- target: aarch64-unknown-linux-gnu
docker: linux/arm64
- target: x86_64-unknown-linux-gnu
docker: linux/amd64
image:
- name: relay
features: "processing,crash-handler"

name: Build Docker Image
runs-on: ubuntu-latest

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

env:
DOCKER_IMAGE: "ghcr.io/getsentry/${{ matrix.image.name }}:${{ github.event.pull_request.head.sha || github.sha }}"

steps:
- uses: actions/checkout@v4
Expand All @@ -198,18 +210,40 @@ jobs:
- uses: swatinem/rust-cache@v2
with:
key: ${{ github.job }}-${{ matrix.arch }}
- name: Get Cross
- name: Install Cross
run: cargo install cross

- name: Compile
run: |
export PATH="/home/runner/.cargo/bin/:$PATH"
cross build --all-features --release --target "${{ matrix.target }}"
cross build --release --features "${{ matrix.image.features }}" --target "${{ matrix.platform.target }}"
- name: Archive Binary
uses: actions/upload-artifact@v4
with:
name: "relay-${{ matrix.target }}"
path: "target/${{ matrix.target }}/release/relay"
# - name: Archive Binary
# uses: actions/upload-artifact@v4
# with:
# name: "relay-${{ matrix.target }}"
# path: "target/${{ matrix.target }}/release/relay"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Push to ghcr.io
# Do not run this on forks as they do not have access to secrets
if: "!github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]'"
run: |
set -euxo pipefail
docker login --username '${{ github.actor }}' --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io
cp "target/${{ matrix.target }}/release/relay" ./relay-bin
docker buildx build \
--platform "${{ matrix.platform.docker }}" \
--tag "${DOCKER_IMAGE}" \
--file Dockerfile.release
docker push "${DOCKER_IMAGE}"
# build:
# timeout-minutes: 30
Expand Down
7 changes: 1 addition & 6 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
[build]
pre-build = [
# "dpkg --add-architecture $CROSS_DEB_ARCH",
# "apt-get update && apt-get --assume-yes install -f -o Dpkg::Options::=\"--force-overwrite\" libclang-dev:$CROSS_DEB_ARCH"
"printf \"deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-12 main\" |sudo tee /etc/apt/sources.list.d/llvm-toolchain-xenial-12.list",
"wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key |sudo apt-key add -",
# "apt-get update && apt-cache search clang && apt-get --assume-yes install libclang-5.0-dev clang-3.8"
"apt-get update && apt-cache search clang && apt-get --assume-yes install llvm-12"
"apt-get update && apt-get --assume-yes install libclang-5.0-dev clang-3.8"
]

0 comments on commit 4e044f3

Please sign in to comment.