Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: isolated tests of functionality #956

Open
wants to merge 102 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
172ffa5
initial migration of container infra from bioconda-containers
daler Feb 9, 2024
40cee01
first draft of build script
daler Feb 9, 2024
d68171b
rename/reorganize
daler Feb 11, 2024
acb1d84
parameterize busybox image to copy from
daler Feb 11, 2024
988ee01
git checkout parameterized branch
daler Feb 11, 2024
a4801a5
parameterize busybox image
daler Feb 11, 2024
de2635b
depend on passed-in conda/mamba versions
daler Feb 11, 2024
5a00ef3
first round of refactoring build-images.yml
daler Feb 11, 2024
8fb2257
move generic build to top, and adjust workflow
daler Feb 11, 2024
e9864ba
split out base-debian into an independent job
daler Feb 12, 2024
9ffeda8
factor out archs
daler Feb 12, 2024
c7ac9b1
add build-env and create-env
daler Feb 12, 2024
8ffc3ea
try using branch name for now
daler Feb 12, 2024
a971e5d
fix path
daler Feb 13, 2024
976f350
rm redundant if clause
daler Feb 13, 2024
5d3acc7
parameterize create-env test to use local images
daler Feb 13, 2024
e368e39
check for existing tags
daler Feb 13, 2024
bbbd9d3
allow missing repository on quay.io if configured
daler Feb 13, 2024
36d2fc6
add ARG for next FROM context
daler Feb 13, 2024
03c2472
add build script for local testing (may be moved later)
daler Feb 13, 2024
b7a6f4a
add docs
daler Feb 13, 2024
3ff8d68
parameterize archs
daler Feb 13, 2024
b580a38
rm manifests by default before building locally
daler Feb 13, 2024
cfd7b85
add switches to build each container
daler Feb 13, 2024
073c3df
fix arg
daler Feb 15, 2024
33e6ff4
use python (which will come from conda-forge)
daler Feb 15, 2024
0475a92
improve comments in build.sh
daler Feb 17, 2024
fd21947
warn -> error
daler Feb 17, 2024
7399905
move test build-args closer to actual test
daler Feb 17, 2024
be2b3f0
clean up buildah inspect output
daler Feb 17, 2024
324d8ee
overhaul how tests are run, plus notes & comments
daler Feb 17, 2024
06b138c
warn -> error in workflow
daler Feb 17, 2024
3f62390
rm build docker container from prev workflow
daler Feb 17, 2024
315604e
first attempt at pushing base-debian
daler Feb 17, 2024
5f91c86
for now always try pushing
daler Feb 17, 2024
8b019bb
hard code registry like bioconda-containers
daler Feb 17, 2024
072c987
add comments and ids to workflow
daler Feb 17, 2024
8e26443
start support for logging
daler Feb 17, 2024
c545c66
attempt to control github actions via log
daler Feb 17, 2024
f8783f4
mess with conditionals
daler Feb 17, 2024
66926b4
single-quote to match others
daler Feb 17, 2024
55919a1
no env var
daler Feb 17, 2024
7b15c02
now try version bump
daler Feb 17, 2024
2aec81c
more conditional
daler Feb 17, 2024
b4d4cbf
enable builds and pushes for other containers
daler Feb 17, 2024
5298c43
swap out registry depending on if tag exists
daler Feb 17, 2024
250b47b
do registry swap for create-env
daler Feb 17, 2024
ac3d8aa
lots o' comments
daler Feb 17, 2024
daddbd4
TIL GHA expressions work in comments
daler Feb 17, 2024
bbecba3
missing will now become error
daler Feb 17, 2024
59d8b30
bump just base version to test behavior
daler Feb 17, 2024
860adc0
explicitly specify (single) tag, and add to bioconda-utils version
daler Feb 17, 2024
14c43c5
be better about tags
daler Feb 18, 2024
0d6602e
fix tags
daler Feb 18, 2024
9b62f67
add "base" to base version
daler Feb 18, 2024
f9b8720
add base prefix to upload steps
daler Feb 18, 2024
ab41890
bump version to ensure 'latest' tags get pushed
daler Feb 18, 2024
efe0154
move pushes to end
daler Feb 18, 2024
64226bf
runs-on
daler Feb 18, 2024
ece22a2
don't depend on test
daler Feb 18, 2024
1b28410
fix job outputs
daler Feb 18, 2024
9bcd6c7
better message when tag exists
daler Feb 18, 2024
bd16b6a
comments cleanup
daler Feb 18, 2024
1ffb34d
add test before push
daler Feb 18, 2024
9a02abc
typo
daler Feb 18, 2024
b39c87c
typo
daler Feb 18, 2024
b654430
keep recipes in work dir
daler Feb 18, 2024
f47c2de
activate env in test
daler Feb 18, 2024
cb8157d
eval hook
daler Feb 18, 2024
3166fbd
include output for bioconda-utils version in job
daler Feb 18, 2024
a428b4b
fix names
daler Feb 18, 2024
aedd032
bump version for end-to-end testing
daler Feb 18, 2024
26325e9
don't use "localhost" as registry for docker
daler Feb 18, 2024
ec3704c
registry includes the slash
daler Feb 18, 2024
56b1fe2
convert back to steps rather than jobs
daler Feb 19, 2024
81aca27
need to podman push images to docker-daemon so docker can use
daler Feb 19, 2024
15c1954
update build.sh for local tests
daler Feb 19, 2024
01122df
comments and cleanup
daler Feb 19, 2024
bd90014
tags need bioconda-utils version
daler Feb 19, 2024
7d6f5c8
use correct output
daler Feb 19, 2024
7ce9bd1
attempt pushing to docker-daemon
daler Feb 19, 2024
8b7b1ff
disable some jobs so we can do some container pushing tests
daler Feb 19, 2024
dc4514a
try pushing to ghcr.io
daler Feb 19, 2024
6a177d2
rm push to docker daemon
daler Feb 19, 2024
3188ea3
login to ghcr
daler Feb 19, 2024
39ab36a
test pull from ghcr
daler Feb 19, 2024
93cb439
yaml syntax
daler Feb 19, 2024
ce45345
try building everything and pushing/pulling to/from ghcr.io
daler Feb 19, 2024
9967d44
re-enable build-others job
daler Feb 19, 2024
c4554f7
get bioconda-utils version from step output
daler Feb 19, 2024
73aef1c
get bioconda-utils version from build-other job
daler Feb 20, 2024
2ce4b8c
aaaand use right output
daler Feb 20, 2024
c5eb650
push the right image
daler Feb 20, 2024
f45e2ff
add additional label to tie to bioconda-utils
daler Feb 20, 2024
e9c6b7f
fix label
daler Feb 20, 2024
c8cb13e
new version number to see if ghcr will make public
daler Feb 20, 2024
e291d36
ensure all tags are pulled
daler Feb 20, 2024
94023e6
stripped down yml for testing isolated functionality
daler Feb 20, 2024
ffea552
echo
daler Feb 20, 2024
ecd7893
fix
daler Feb 20, 2024
f972684
fix
daler Feb 20, 2024
b6404e8
fix
daler Feb 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/workflows/GithubActionTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ concurrency:

jobs:
test-linux:
if: false
name: Linux tests
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -33,13 +34,6 @@ jobs:
conda activate bioconda
python setup.py install

- name: Build docker container
run: |
docker build -t quay.io/bioconda/bioconda-utils-build-env-cos7:latest ./
docker history quay.io/bioconda/bioconda-utils-build-env-cos7:latest
docker run --rm -t quay.io/bioconda/bioconda-utils-build-env-cos7:latest sh -lec 'type -t conda && conda info -a && conda list'
docker build -t quay.io/bioconda/bioconda-utils-test-env-cos7:latest -f ./Dockerfile.test ./

- name: Run tests '${{ matrix.py_test_marker }}'
run: |
eval "$(conda shell.bash hook)"
Expand All @@ -50,6 +44,7 @@ jobs:
echo "Skipping pytest - only docs modified"
fi
test-macosx:
if: false
name: OSX tests
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -81,6 +76,7 @@ jobs:
fi

autobump-test:
if: false
name: autobump test
runs-on: ubuntu-latest
steps:
Expand Down
63 changes: 0 additions & 63 deletions .github/workflows/build-image.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Build all container images.
#
# Most of the work is done in generic_build.bash, so see that file for details.

name: Build images
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
paths-ignore:
- '.circleci/**'
- 'docs/**'
- 'test/**'

env:
BIOCONDA_UTILS_VERSION: ${{ github.event.release && github.event.release.tag_name || github.head_ref || github.ref_name }}
tags: "0.1 latest"

jobs:

build-image:
runs-on: ubuntu-20.04
steps:
- name: build
run: |
set -x
echo $BIOCONDA_UTILS_VERSION
echo '${{ secrets.GITHUB_TOKEN }}' | podman login ghcr.io -u '${{ github.actor }}' --password-stdin
mkdir img
cd img
echo "FROM debian:12.1-slim" > Dockerfile

for tag in $tags; do
buildah manifest create "test:$tag"
done

for arch in amd64 arm64; do
buildah bud --arch $arch --file Dockerfile --iidfile=$arch.id
image_id="$(cat $arch.id)"
container="$( buildah from ${image_id} )"
buildah config --label=org.opencontainers.image.source=https://github.com/bioconda/bioconda-utils "${container}"
image_id="$( buildah commit "${container}" )"
buildah rm "${container}"

for tag in $tags; do
buildah tag "${image_id}" "test:$tag-$arch"
buildah manifest add "test:$tag" "${image_id}"
done

done

for tag in $tags; do
podman push "localhost/test:$tag" "ghcr.io/bioconda/test:$tag"
done


pull-image:
runs-on: ubuntu-20.04
needs: [build-image]
steps:
- name: pull
run: |
for tag in $tags; do
podman pull "ghcr.io/bioconda/test:$tag"
docker pull "ghcr.io/bioconda/test:$tag"
done
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ docs/source/developer/_autosummary

# Mac OS Files
.DS_Store
env
recipes/
124 changes: 124 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/bin/bash

# create-env depends on base-busybox and build-env (which in turn also depends
# on base-busybox). base-debian is independent.
#
# This can be run locally for testing, and can be used as a template for CI.
#
# base-busybox base-debian
# | |
# build-env |
# \ |
# \ |
# create-env

set -euo

# Used for build-env.
# bioconda-utils will be cloned to this folder inside the image dir (where the
# Dockerfile is) and the version will be checked out.
export BIOCONDA_UTILS_FOLDER=bioconda-utils
export BIOCONDA_UTILS_VERSION=v2.11.1

export DEBIAN_VERSION="12.2"
export BUSYBOX_VERSION="1.36.1"

# Use same tags for base-busybox and base-debian
export BASE_TAG="0.1"

# If the repository doesn't already exist on quay.io, by default this is
# considered an error. Set to false to avoid this (e.g., when building images
# with new names, or local test ones).
export ERROR_IF_MISSING=false

# Architectures to build for (under emulation)
export ARCHS="arm64 amd64"

# Store as separate vars so we can use these for dependencies.
BUILD_ENV_IMAGE_NAME=tmp-build-env
CREATE_ENV_IMAGE_NAME=tmp-create-env
BASE_DEBIAN_IMAGE_NAME=tmp-debian
BASE_BUSYBOX_IMAGE_NAME=tmp-busybox

BUILD_BUSYBOX=false # build busybox image?
BUILD_DEBIAN=true # build debian image?
BUILD_BUILD_ENV=false # build build-env image?
BUILD_CREATE_ENV=false # build create-env image?

# # Build base-busybox------------------------------------------------------------
if [ $BUILD_BUSYBOX == "true" ]; then

buildah manifest rm "${BASE_BUSYBOX_IMAGE_NAME}:${BASE_TAG}" || true
buildah manifest rm "${BASE_BUSYBOX_IMAGE_NAME}:latest" || true

IMAGE_NAME=$BASE_BUSYBOX_IMAGE_NAME \
IMAGE_DIR=images/base-glibc-busybox-bash \
ARCHS=$ARCHS \
TYPE="base-busybox" \
TAG=$BASE_TAG \
./generic_build.bash
fi

# Build base-debian-------------------------------------------------------------
if [ $BUILD_DEBIAN == "true" ]; then

buildah manifest rm "${BASE_DEBIAN_IMAGE_NAME}:${BASE_TAG}" || true
buildah manifest rm "${BASE_DEBIAN_IMAGE_NAME}:latest" || true

IMAGE_NAME=$BASE_DEBIAN_IMAGE_NAME \
IMAGE_DIR=images/base-glibc-debian-bash \
ARCHS=$ARCHS \
TYPE="base-debian" \
TAG=$BASE_TAG \
./generic_build.bash
fi

# Build build-env---------------------------------------------------------------

if [ $BUILD_BUILD_ENV == "true" ]; then
# Clone bioconda-utils into same directory as Dockerfile
if [ ! -e "images/bioconda-utils-build-env-cos7/bioconda-utils" ]; then
git clone https://github.com/bioconda/bioconda-utils images/bioconda-utils-build-env-cos7/bioconda-utils
else
(cd images/bioconda-utils-build-env-cos7/bioconda-utils && git fetch)
fi

buildah manifest rm "${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_UTILS_VERSION}-base${BASE_TAG}" || true
buildah manifest rm "${BUILD_ENV_IMAGE_NAME}:latest" || true

IMAGE_NAME=$BUILD_ENV_IMAGE_NAME \
IMAGE_DIR=images/bioconda-utils-build-env-cos7 \
ARCHS=$ARCHS \
TYPE="build-env" \
TAG=$BASE_TAG \
BUSYBOX_IMAGE=localhost/$BASE_BUSYBOX_IMAGE_NAME \
./generic_build.bash
fi
# # Build create-env--------------------------------------------------------------

if [ $BUILD_CREATE_ENV == "true" ]; then

buildah manifest rm "${CREATE_ENV_IMAGE_NAME}:${BIOCONDA_UTILS_VERSION}-base${BASE_TAG}" || true
buildah manifest rm "${CREATE_ENV_IMAGE_NAME}:latest" || true

# Get the exact versions of mamba and conda that were installed in build-env.
CONDA_VERSION=$(
podman run -t localhost/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_UTILS_VERSION} \
bash -c "/opt/conda/bin/conda list --export '^conda$'| sed -n 's/=[^=]*$//p'"
)
MAMBA_VERSION=$(
podman run -t localhost/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_UTILS_VERSION} \
bash -c "/opt/conda/bin/conda list --export '^mamba$'| sed -n 's/=[^=]*$//p'"
)
# Remove trailing \r with parameter expansion
export CONDA_VERSION=${CONDA_VERSION%$'\r'}
export MAMBA_VERSION=${MAMBA_VERSION%$'\r'}

IMAGE_NAME=$CREATE_ENV_IMAGE_NAME \
IMAGE_DIR=images/create-env \
ARCHS=$ARCHS \
TYPE="create-env" \
TAG=$BASE_TAG \
BUSYBOX_IMAGE=localhost/$BASE_BUSYBOX_IMAGE_NAME \
./generic_build.bash
fi
Loading