Test docker image #29
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: Docker | |
run-name: Test docker image | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: 'Build image' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-node@v4 | |
- name: Setup docker (missing on MacOS) | |
if: runner.os == 'macos' | |
run: | | |
brew install docker | |
colima start | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Build server docker image | |
uses: docker/build-push-action@v6 | |
with: | |
tags: lean4monaco:latest | |
outputs: type=docker,dest=/tmp/lean4monaco.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lean4monaco | |
path: /tmp/lean4monaco.tar | |
test: | |
needs: build | |
name: Test image | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# needed to run cypress | |
- name: Install dependencies | |
run: npm install | |
- name: Download server image | |
uses: actions/download-artifact@v4 | |
with: | |
name: lean4monaco | |
path: /tmp | |
- name: Load server image | |
run: docker load --input /tmp/lean4monaco.tar | |
- name: Start server | |
run: docker run -dit -p 5173:5173 -p 8080:8080 lean4monaco | |
- name: Run tests (electron) | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: electron | |
wait-on: 'http://localhost:5173' |