Skip to content

Commit

Permalink
[soil] Factor out host-shim
Browse files Browse the repository at this point in the history
Use it on Github Actions.
  • Loading branch information
Andy C committed Dec 8, 2021
1 parent ada5006 commit 2586f84
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 37 deletions.
40 changes: 6 additions & 34 deletions .github/workflows/all-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,12 @@ jobs:

- name: install
run: |
# It's already installed
# sudo apt-get install -y podman
# Hack for Docker. We write this file from inside the container and
# outside.
dir=$REPO_ROOT/_tmp/soil
mkdir -p $dir
sudo chmod --verbose 777 $dir
ls -l -d $dir
soil/host-shim.sh docker-mount-perms $REPO_ROOT
- name: dummy
run: |
# Podman gets rid of _tmp/soil permission error.
# We write into that directory afterward and then deploy the whole
# thing.
docker=docker
#docker=podman
image=docker.io/oilshell/soil-dummy
time $docker pull $image
$docker run \
--mount "type=bind,source=$REPO_ROOT,target=/app/oil" \
$image \
sh -c 'cd /app/oil; soil/worker.sh run-dummy'
cd $REPO_ROOT
soil/host-shim.sh run-task docker $REPO_ROOT dummy
- name: publish-html
env:
Expand All @@ -83,22 +65,12 @@ jobs:

- name: install
run: |
# Hack for Docker
dir=$REPO_ROOT/_tmp/soil
mkdir -p $dir
sudo chmod --verbose 777 $dir
ls -l -d $dir
soil/host-shim.sh docker-mount-perms $REPO_ROOT
- name: dev-minimal
run: |
docker=docker
image=docker.io/oilshell/soil-dev-minimal
time $docker pull $image
$docker run \
--mount "type=bind,source=$REPO_ROOT,target=/app/oil" \
$image \
sh -c 'cd /app/oil; soil/worker.sh run-dev-minimal'
cd $REPO_ROOT
soil/host-shim.sh run-task docker $REPO_ROOT dev-minimal
- name: publish-html
env:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ shell, of course!
# moved to tests/ if automated.
old/ # A junk drawer.
web/ # HTML/JS/CSS for tests and tools
services/ # Integration with cloud services (e.g. Travis CI)
soil/ # Multi-cloud continuous build (e.g. sourcehut, Github)
services/ # Other cloud services

### Temp Dirs

Expand Down
35 changes: 35 additions & 0 deletions soil/host-shim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
#
# Shell functions run on the host machine, OUTSIDE the container.
#
# Usage:
# soil/host-shim.sh <function name>

set -o nounset
set -o pipefail
set -o errexit

docker-mount-perms() {
local repo_root=$1
local dir=$repo_root/_tmp/soil
mkdir -p $dir
sudo chmod --verbose 777 $dir
ls -l -d $dir
}

run-task() {
local docker=$1 # docker or podman
local repo_root=$2
local task=$3 # e.g. dev-minimal

local image=docker.io/oilshell/soil-$task

time $docker pull $image

$docker run \
--mount "type=bind,source=$repo_root,target=/app/oil" \
$image \
sh -c "cd /app/oil; soil/worker.sh run-$task"
}

"$@"
1 change: 0 additions & 1 deletion soil/worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ dev-minimal-tasks() {

# (task_name, script, action, result_html)
cat <<EOF
link-busybox-ash test/spec.sh link-busybox-ash -
build-minimal build/dev.sh minimal -
repo-overview metrics/source-code.sh all -
lint test/lint.sh travis -
Expand Down
7 changes: 6 additions & 1 deletion test/spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ tea-all() {
}

osh-minimal() {
check-shells-exist # e.g. depends on link-busybox-ash
### Some tests that work on the minimal build. Run by Soil.

# dev-minimal CI task needs this done first
link-busybox-ash

check-shells-exist

# oil-json: for testing yajl
cat >_tmp/spec/SUITE-osh-minimal.txt <<EOF
Expand Down

0 comments on commit 2586f84

Please sign in to comment.