mirror of
https://github.com/bensuperpc/dockcross.git
synced 2025-03-12 17:20:08 +01:00
ci: multi-arch deploy
Upload artifacts for the multi-arch images, then download, load them, and deploy them along with multi-arch manifests after both finished building.
This commit is contained in:
parent
07ac7479b5
commit
f473b99340
83
.github/workflows/main.yml
vendored
83
.github/workflows/main.yml
vendored
@ -126,7 +126,7 @@ jobs:
|
|||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
image: "android-arm64",
|
image: "android-arm64",
|
||||||
multiarch: "",
|
multiarch: "yes",
|
||||||
stockfish: "yes",
|
stockfish: "yes",
|
||||||
stockfish_arg: "ARCH=armv8 COMP=ndk",
|
stockfish_arg: "ARCH=armv8 COMP=ndk",
|
||||||
ninja: "no",
|
ninja: "no",
|
||||||
@ -1469,8 +1469,85 @@ jobs:
|
|||||||
cd ..
|
cd ..
|
||||||
rm -rf libopencm3
|
rm -rf libopencm3
|
||||||
|
|
||||||
- name: deploy
|
- name: archive ${{ matrix.arch_name.image }}-${{ matrix.os }}
|
||||||
|
if: matrix.arch_name.multiarch != 'yes'
|
||||||
|
run: |
|
||||||
|
mkdir -p cache-${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }}
|
||||||
|
docker export dockcross/${{ matrix.arch_name.image }}:latest-${{ env.HOST_ARCH }} | xz -e9 -T0 > ./cache/${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }}.tar.xz
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: save ${{ matrix.arch_name.image }}-${{ matrix.os }}
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
if: matrix.arch_name.multiarch != 'yes'
|
||||||
|
with:
|
||||||
|
name: cache-${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }}
|
||||||
|
path: ./cache/${{ matrix.arch_name.image }}-${{ env.HOST_ARCH }}.tar.xz
|
||||||
|
retention-days: 3
|
||||||
|
|
||||||
|
|
||||||
|
- name: deploy-not-multi-arch
|
||||||
|
if: github.ref == 'refs/heads/master' && matrix.arch_name.multiarch != 'yes' && env.HOST_ARCH == 'amd64'
|
||||||
|
run: |
|
||||||
|
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }}
|
||||||
|
make ${{ matrix.arch_name.image }}.push
|
||||||
|
|
||||||
|
deploy-multi-arch-images:
|
||||||
|
name: ${{ matrix.arch_name.image }}
|
||||||
|
needs: [${{ matrix.arch_name.image }}_on_ubuntu-22.04, ${{ matrix.arch_name.image }}_on_ubuntu-22.04-arm]
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch_name:
|
||||||
|
- {
|
||||||
|
image: "android-arm64"
|
||||||
|
}
|
||||||
|
- {
|
||||||
|
image: "web-wasm",
|
||||||
|
}
|
||||||
|
- {
|
||||||
|
image: "web-wasi",
|
||||||
|
}
|
||||||
|
- {
|
||||||
|
image: "web-wasi-threads",
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: "recursive"
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: set host_arch
|
||||||
|
run: |
|
||||||
|
echo "HOST_ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: download ${{ matrix.arch_name.image }}-amd64
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: cache-${{ matrix.arch_name.image }}-amd64
|
||||||
|
path: ./cache/${{ matrix.arch_name.image }}-amd64.tar.xz
|
||||||
|
|
||||||
|
- name: download ${{ matrix.arch_name.image }}-arm64
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: cache-${{ matrix.arch_name.image }}-arm64
|
||||||
|
path: ./cache/${{ matrix.arch_name.image }}-arm64.xz
|
||||||
|
|
||||||
|
- name: load images
|
||||||
|
run: |
|
||||||
|
xz -d -k < ./cache/${{ matrix.arch_name.image }}-amd64.tar.xz | docker import - dockcross/${{ matrix.arch_name.image }}-amd64
|
||||||
|
xz -d -k < ./cache/${{ matrix.arch_name.image }}-arm64.tar.xz | docker import - dockcross/${{ matrix.arch_name.image }}-arm64
|
||||||
|
|
||||||
|
- name: deploy-multi-arch
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
run: |
|
run: |
|
||||||
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }}
|
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }}
|
||||||
docker image push dockcross/${{ matrix.arch_name.image }} --all-tags
|
|
||||||
|
make ${{ matrix.arch_name.image }}.tag-amd64
|
||||||
|
make ${{ matrix.arch_name.image }}.tag-arm64
|
||||||
|
|
||||||
|
make ${{ matrix.arch_name.image }}.push-amd64
|
||||||
|
make ${{ matrix.arch_name.image }}.push-arm64
|
||||||
|
|
||||||
|
make ${{ matrix.arch_name.image }}.push
|
||||||
|
5
Makefile
5
Makefile
@ -363,6 +363,11 @@ $(addsuffix .test,$(MULTIARCH_IMAGES) web-wasi-threads): $$(basename $$@)
|
|||||||
&& chmod +x $(BIN)/dockcross-$(basename $@)
|
&& chmod +x $(BIN)/dockcross-$(basename $@)
|
||||||
$(BIN)/dockcross-$(basename $@) -i $(ORG)/$(basename $@):latest-$(HOST_ARCH) python3 test/run.py $($@_ARGS)
|
$(BIN)/dockcross-$(basename $@) -i $(ORG)/$(basename $@):latest-$(HOST_ARCH) python3 test/run.py $($@_ARGS)
|
||||||
|
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
$(addsuffix .tag-$(HOST_ARCH),$(MULTIARCH_IMAGES) web-wasi-threads web-wasm): $$(basename $$@)
|
||||||
|
$(BUILD_DOCKER) tag $(ORG)/$(basename $@):latest-$(HOST_ARCH) \
|
||||||
|
$(ORG)/$(basename $@):$(TAG)-$(HOST_ARCH)
|
||||||
|
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
$(addsuffix .push-$(HOST_ARCH),$(MULTIARCH_IMAGES) web-wasi-threads web-wasm): $$(basename $$@)
|
$(addsuffix .push-$(HOST_ARCH),$(MULTIARCH_IMAGES) web-wasi-threads web-wasm): $$(basename $$@)
|
||||||
$(BUILD_DOCKER) push $(ORG)/$(basename $@):latest-$(HOST_ARCH) \
|
$(BUILD_DOCKER) push $(ORG)/$(basename $@):latest-$(HOST_ARCH) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user