Skip to content

Test docker image

Test docker image #2

Workflow file for this run

name: Docker
run-name: Test docker image
on:
workflow_dispatch:
push:
branches: ["main"] # replace "main" with the default branch
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
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
# # strategy:
# # fail-fast: false
# # matrix:
# # include:
# # - name: Linux
# # os: ubuntu-latest
# # - name: macOS
# # os: macos-latest
# # - name: Windows
# # os: windows-latest
# # name: ${{ matrix.name }}
# # runs-on: ${{ matrix.os }}
name: Test image
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
with:
submodules: true
# - uses: leanprover/lean-action@v1
# if: matrix.os != 'windows-latest'
# with:
# lake-package-directory: "demo/server/LeanProject"
# use-mathlib-cache: false
# auto-config: false
# build: true
# test: false
# lint: false
# - name: Install elan (Windows)
# if: matrix.os == 'windows-latest'
# run: |
# curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf > elan-init.sh
# bash elan-init.sh -y
# echo "$(realpath ~/.elan/bin)" >> $GITHUB_PATH
# shell: bash
# - name: Run lake build (Windows)
# if: matrix.os == 'windows-latest'
# run: |
# cd demo/server/LeanProject
# lake build
# shell: bash
- name: Install dependencies
run: npm install
# - name: Build
# run: npm run build
# - run: npm run setup_demo
- 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
uses: cypress-io/github-action@v6
with:
# browser: chrome
# start: npm start
wait-on: 'http://localhost:5173'
# test:
# strategy:
# fail-fast: false
# matrix:
# include:
# - name: Linux
# os: ubuntu-latest
# - name: macOS
# os: macos-latest
# - name: Windows
# os: windows-latest
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# - name: build docker image
# run: docker build -t hhu-adam/lean4monaco .
# - name: start server
# run: docker run -dit -p 5173:5173 -p 8080:8080 hhu-adam/lean4monaco
# - name: Run tests
# uses: cypress-io/github-action@v6
# with:
# browser: chrome
# # start: npm start
# wait-on: 'http://localhost:5173'
# start-server:
# name: Start server
# runs-on: ubuntu-latest
# # outputs:
# # server-url: ${{ steps.server-output.outputs.server-url }}
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# - uses: actions/setup-node@v4
# - uses: leanprover/lean-action@v1
# with:
# lake-package-directory: "demo/server/LeanProject"
# use-mathlib-cache: false
# auto-config: false
# build: true
# test: false
# lint: false
# - name: Install dependencies
# run: npm install
# - name: Build and setup demo
# run: npm run setup_demo
# # - name: Build lean4monaco
# # run: npm run build
# # - name: Build demo server
# # run: |
# # cd demo
# # npm run build
# - name: Start server
# id: start-server
# run: |
# nohup npm start > nohup.out 2> nohup.err < /dev/null &
# echo "server is running..."
# # cd demo
# # echo "Starting server..."
# # npm run start
# # # nohup npm run start > nohup.out 2> nohup.err < /dev/null &
# # echo "server is running."
# test:
# strategy:
# fail-fast: false
# matrix:
# include:
# - name: Linux
# os: ubuntu-latest
# # - name: macOS
# # os: macos-latest
# - name: Windows
# os: windows-latest
# name: ${{ matrix.name }}
# runs-on: ${{ matrix.os }}
# needs: start-server
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# - uses: actions/setup-node@v4
# - name: Install dependencies
# run: npm install
# # - name: Wait for server
# # run: |
# # echo "Pinging the server to check if it's up..."
# # for i in {1..30}; do
# # curl -sSf http://localhost:5173 && break
# # echo "Waiting for server..."
# # sleep 5
# # done
# # - name: Run Cypress tests
# # run: |
# # # wait-on http://localhost:5173
# # cypress run
# # # # Install npm dependencies, cache them correctly
# # and run all Cypress tests
# - name: Run tests
# uses: cypress-io/github-action@v6
# with:
# browser: chrome
# # start: npm start
# # wait-on: 'http://localhost:5173'
# name: Test
# run-name: Test editor end-to-end
# on:
# workflow_dispatch:
# push:
# branches: ["main"] # replace "main" with the default branch
# pull_request:
# branches: ["main"]
# concurrency:
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# cancel-in-progress: true
# jobs:
# test:
# strategy:
# fail-fast: false
# matrix:
# include:
# - name: Linux
# os: ubuntu-latest
# - name: macOS
# os: macos-latest
# - name: Windows
# os: windows-latest
# name: ${{ matrix.name }}
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# - uses: leanprover/lean-action@v1
# if: matrix.os != 'windows-latest'
# with:
# lake-package-directory: "demo/server/LeanProject"
# use-mathlib-cache: false
# build: true
# test: false
# lint: false
# - name: Install elan (Windows)
# if: matrix.os == 'windows-latest'
# run: |
# curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf > elan-init.sh
# bash elan-init.sh -y
# echo "$(realpath ~/.elan/bin)" >> $GITHUB_PATH
# shell: bash
# - name: Run lake build (Windows)
# if: matrix.os == 'windows-latest'
# run: |
# cd demo/server/LeanProject
# lake build
# shell: bash
# - uses: actions/setup-node@v4
# # Install npm dependencies, cache them correctly
# # and run all Cypress tests
# - name: Run tests
# uses: cypress-io/github-action@v6
# with:
# start: npm start
# wait-on: 'http://localhost:5173'
# - run: npm audit
# if: matrix.os == 'ubuntu-latest'
# continue-on-error: true