shorter find commands #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests | |
on: | |
push: | |
branches: [xx-docker] | |
jobs: | |
build-push-docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
id: builder1 | |
- name: Cache | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: | | |
usr-local-cargo-git-db | |
usr-local-cargo-registry-cache | |
usr-local-cargo-registry-index | |
src-target | |
key: docker-xx | |
- name: inject cache into docker | |
uses: reproducible-containers/[email protected] | |
with: | |
cache-map: | | |
{ | |
"usr-local-cargo-git-db": "/usr/local/cargo/git/db", | |
"usr-local-cargo-registry-cache": "/usr/local/cargo/registry/cache", | |
"usr-local-cargo-registry-index": "/usr/local/cargo/registry/index", | |
"src-target": "/src/target" | |
} | |
skip-extraction: ${{ steps.cache.outputs.cache-hit }} | |
- name: cross-compile all binaries | |
# Building in a loop shows errors quicker and may be a bit faster as it's choking building 3 | |
# rust targets in parallel | |
run: mkdir -p target/cross && docker buildx ls && | |
for platform in linux/arm/v7 linux/amd64 linux/arm64; do | |
mkdir -p target/cross/$platform && | |
docker build --builder ${{ steps.builder1.outputs.name }} | |
--platform $platform | |
-f docker/Dockerfile.xx | |
--output type=local,dest=target/cross/$platform | |
. | |
; | |
done | |
- name: list files | |
run: find target/cross/ | |
# # linux_amd64/bin/rqbit -> linux/amd64/rqbit | |
# # linux_arm64/bin/rqbit -> linux/arm64/rqbit | |
# # linux_arm_v7/bin/rqbit -> linux/arm/v7/rqbit | |
# - name: Reorganize binaries in target/cross | |
# run: find target/cross & | |
# mkdir -p target/cross/linux/amd64/ target/cross/linux/arm64/ target/cross/linux/arm/v7 && | |
# cd target/cross/ && | |
# mv linux_amd64/bin/rqbit linux/amd64/ && chmod +x linux/amd64/rqbit && | |
# mv linux_arm64/bin/rqbit linux/arm64/ && chmod +x linux/arm64/rqbit && | |
# mv linux_arm_v7/bin/rqbit linux/arm/v7/ && chmod +x linux/arm/v7/rqbit | |
# TODO: publish these as artifacts | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: ikatson/rqbit:${{ github.ref_name }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
context: target/cross/ | |
file: docker/Dockerfile |