Skip to content

Commit

Permalink
Multi platform builds (#74)
Browse files Browse the repository at this point in the history
* test arm64 build
* add seperate dockerfile form arm64
add to build jobs
* builds for arm64 target
* overwrite qemu binfmt config on start
* seperate action jobs for two archs
add sidebar on package overview to show lots of aur stuff
link to aur homepage of package
setup code for multiplatform builds
* add real description from aur
* add database migration to store platforms and build flags
* use tags selected in addpackage view properly
show right archs and build flags on sidepanel
* supported platforms just arm64/32 bc. of docker archlinux availability limitations
* new endpoint for retrying builds
fix updateing pkgs by updating all platforms
* new patch endpoint to update package
finish pkg settings page
* split to seperate repos per architecture
fix names of platforms to same names as pacman $arch
try to move old files to new dir while migrating
  • Loading branch information
Lukas-Heiligenbrunner authored Sep 30, 2024
1 parent 8fbcb16 commit 9909085
Show file tree
Hide file tree
Showing 65 changed files with 1,938 additions and 442 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '!master'

jobs:
build-and-push:
build-amd64:
runs-on: ubuntu-latest

steps:
Expand All @@ -20,6 +20,24 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
run: |
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} .
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} --build-arg TARGET_ARCH=linux/amd64 -f ./docker/Dockerfile .
build-aarch64:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build ARM64 Docker image
run: |
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} --build-arg TARGET_ARCH=linux/arm64/v8 -f ./docker/Dockerfile .
44 changes: 44 additions & 0 deletions .github/workflows/docker-builder-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Make helper containers
on:
workflow_dispatch:
push:
branches:
- "**"

jobs:
build:
name: Build AUR enabled Arch containers
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v2
- id: repo_name_lc
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build paru container
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
context: .
file: ./docker/builder.Dockerfile
tags: |
ghcr.io/lukas-heiligenbrunner/aurcache-builder:latest
43 changes: 40 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- '*'

jobs:
build-and-push:
build-and-push-arm64:
runs-on: ubuntu-latest

steps:
Expand All @@ -34,13 +34,50 @@ jobs:
- name: Build and push Docker image for main branch
if: github.ref == 'refs/heads/master'
run: |
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} -t ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:git .
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} --build-arg TARGET_ARCH=linux/amd64 -f ./docker/Dockerfile -t ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:git .
docker push ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:git
- name: Build and push Docker image for tag
if: startsWith(github.ref, 'refs/tags/')
run: |
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} -t ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:${{ steps.extract_tag.outputs.tag }} .
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} --build-arg TARGET_ARCH=linux/amd64 -f ./docker/Dockerfile -t ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:${{ steps.extract_tag.outputs.tag }} .
docker tag ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:${{ steps.extract_tag.outputs.tag }} ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:latest
docker push ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:${{ steps.extract_tag.outputs.tag }}
docker push ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:latest
build-and-push-aarch64:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version tag
id: extract_tag
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"

- id: repo_name_lc
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}

- name: Build and push ARM64 Docker image for main branch
if: github.ref == 'refs/heads/master'
run: |
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} --build-arg TARGET_ARCH=linux/arm64/v8 -f ./docker/Dockerfile.arm64 -t ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:git .
docker push ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:git
- name: Build and push ARM64 Docker image for tag
if: startsWith(github.ref, 'refs/tags/')
run: |
docker build --build-arg LATEST_COMMIT_SHA=${{ github.event.head_commit.id }} --build-arg TARGET_ARCH=linux/arm64/v8 -f ./docker/Dockerfile.arm64 -t ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:${{ steps.extract_tag.outputs.tag }} .
docker tag ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:${{ steps.extract_tag.outputs.tag }} ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:latest
docker push ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:${{ steps.extract_tag.outputs.tag }}
docker push ghcr.io/${{ steps.repo_name_lc.outputs.lowercase }}:latest
63 changes: 55 additions & 8 deletions backend/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
aur-rs = "0.1.1"
tokio = "1.39.2"
anyhow = "1.0.86"
anyhow = "1.0.89"

reqwest = { version = "0.12.5", features = ["blocking", "gzip"] }

Expand All @@ -28,6 +28,9 @@ log = "0.4.22"
backon = "1.2.0"
pacman-repo-utils = {path = "./src/pacman-repo-utils"}

[target.aarch64-unknown-linux-gnu.dependencies]
openssl = { version = "*", features = ["vendored"] }

[[bin]]
name = "aurcache"
path = "src/main.rs"
Expand Down
2 changes: 2 additions & 0 deletions backend/src/api/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ pub fn build_api() -> Vec<Route> {
package_list,
package_add_endpoint,
package_del,
package_update_entity_endpoint,
build_output,
delete_build,
list_builds,
stats,
get_build,
get_package,
rery_build,
package_update_endpoint,
cancel_build,
health
Expand Down
Loading

0 comments on commit 9909085

Please sign in to comment.