Skip to content

Commit

Permalink
[ci/wasm] Try using devcontainers
Browse files Browse the repository at this point in the history
  • Loading branch information
arntanguy committed Dec 17, 2024
1 parent 2b538f0 commit 641fa59
Showing 1 changed file with 72 additions and 55 deletions.
127 changes: 72 additions & 55 deletions .github/workflows/webassembly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,61 +26,78 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build within Docker
run: |
echo "::group::Setup Dockerfile"
mkdir -p /tmp/fotowall-docker
cp -r `pwd` /tmp/fotowall-docker/source
cp docker-emscripten/Dockerfile /tmp/fotowall-docker/Dockerfile
cd /tmp/fotowall-docker
echo "::endgroup::"
echo "::group::Dockerfile used to build fotowall webassembly with emscripten"
cat Dockerfile
echo "::endgroup::"
echo "::group::Build base image"
docker build -t fotowall-ci-${{matrix.os}} .
echo "::endgroup::"
echo "::group::Build within docker"
docker run --rm -v "/tmp/fotowall-docker/source:/src/" -u $(id -u):$(id -g) fotowall-ci-${{matrix.os}} 'mkdir /src/build; cd /src/build; cmake -GNinja .. && ninja'
echo "::endgroup::"
echo "::group::Create fotowall-webassembly.tar.gz archive"
ls /tmp/fotowall-docker/source/build
cd /tmp/fotowall-docker/source/build
mkdir fotowall-webassembly
cp fotowall.js fotowall.html fotowall.wasm qtloader.js qtlogo.svg fotowall-webassembly
tar -czf fotowall-webassembly.tar.gz fotowall-webassembly
cp -r fotowall-webassembly /home/runner/work/fotowall/fotowall
echo "::endgroup::"
- name: Push WebAssembly to Cloudsmith
id: push
# if: github.ref == 'refs/heads/master' && github.repository == 'fotowall/fotowall'
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "raw"
owner: "arntanguy"
repo: "head"
file: "/tmp/fotowall-docker/source/build/fotowall-webassembly.tar.gz"
tags: "latest"
name: "fotowall-webassembly-latest.tar.gz"
summary: "Upload latest webassembly build"
description: "See https://github.com/cloudsmith-io/action"
version: ${{ github.sha}}
# - name: Rsync Deploy to fotowall.arntanguy.fr
# env:
# # define SSH/Rsync destination environment var
# dest: '[email protected]:/home/ubuntu/fotowall.arntanguy.fr'
# - name: Build within Docker
# run: |
# echo "${{secrets.ARNTANGUY_SSH_PRIVATE_KEY}}" > deploy_key
# chmod 600 ./deploy_key
# # WARNING: danger zone here, use --dry-run for any changes
# rsync -chrlvzi --delete \
# -e 'ssh -i ./deploy_key -p 22 -o StrictHostKeyChecking=no' \
# --exclude '/deploy_key' \
# /tmp/fotowall-docker/source/build/fotowall-webassembly/ ${{env.dest}}
# echo "::group::Setup Dockerfile"
# mkdir -p /tmp/fotowall-docker
# cp -r `pwd` /tmp/fotowall-docker/source
# cp docker-emscripten/Dockerfile /tmp/fotowall-docker/Dockerfile
# cd /tmp/fotowall-docker
# echo "::endgroup::"
# echo "::group::Dockerfile used to build fotowall webassembly with emscripten"
# cat Dockerfile
# echo "::endgroup::"
# echo "::group::Build base image"
# docker build -t fotowall-ci-${{matrix.os}} .
# echo "::endgroup::"
# echo "::group::Build within docker"
# docker run --rm -v "/tmp/fotowall-docker/source:/src/" -u $(id -u):$(id -g) fotowall-ci-${{matrix.os}} 'mkdir /src/build; cd /src/build; cmake -GNinja .. && ninja'
# echo "::endgroup::"
# echo "::group::Create fotowall-webassembly.tar.gz archive"
# ls /tmp/fotowall-docker/source/build
# cd /tmp/fotowall-docker/source/build
# mkdir fotowall-webassembly
# cp fotowall.js fotowall.html fotowall.wasm qtloader.js qtlogo.svg fotowall-webassembly
# tar -czf fotowall-webassembly.tar.gz fotowall-webassembly
# cp -r fotowall-webassembly /home/runner/work/fotowall/fotowall
# echo "::endgroup::"
#

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

- name: Deploy to gh-pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
- name: Build and run Dev Container task
uses: devcontainers/[email protected]
with:
folder: /tmp/fotowall-docker/source/build/fotowall-webassembly # The folder the action should deploy.
# Change this to point to your image name
imageName: ghcr.io/fotowall/qt6-emscripten
configFile: ./.devcontainer/qt6-emscripten/devcontainer.json
# Change this to be your CI task/script
runCmd: |
# Add multiple commands to run if needed
make install-packages
make ci-build
mkdir build
cd build
qt-cmake -GNinja ..
ninja
- name: Show results
run: |
ls $GITHUB_WORKSPACE/build
# - name: Push WebAssembly to Cloudsmith
# id: push
# # if: github.ref == 'refs/heads/master' && github.repository == 'fotowall/fotowall'
# uses: cloudsmith-io/action@master
# with:
# api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
# command: "push"
# format: "raw"
# owner: "arntanguy"
# repo: "head"
# file: "/tmp/fotowall-docker/source/build/fotowall-webassembly.tar.gz"
# tags: "latest"
# name: "fotowall-webassembly-latest.tar.gz"
# summary: "Upload latest webassembly build"
# description: "See https://github.com/cloudsmith-io/action"
# version: ${{ github.sha}}

# - name: Deploy to gh-pages 🚀
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# folder: /tmp/fotowall-docker/source/build/fotowall-webassembly # The folder the action should deploy.

0 comments on commit 641fa59

Please sign in to comment.