Skip to content

Commit

Permalink
Add CI (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat authored May 15, 2022
1 parent 917d006 commit 2f032cf
Show file tree
Hide file tree
Showing 13 changed files with 232 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: test
on:
push:
branches:
- master
pull_request:

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set runner IP
id: ip
run: |
iface=$(ls -1 /sys/class/net | sed '/^\(lo\|br-\|veth\|docker\|bond\|dummy\|sit\)/d' | head -n1)
ip=$(ip a show dev ${iface} | sed -n 's|^\s*inet\s\([0-9\.]\+\)/.*|\1|p' | head -n1)
echo ${ip}
echo "::set-output name=ip::${ip}"
sed "s/localhost/${ip}/g" -i $(find test -type f)
- name: Build dummy server
run: cd test && docker-compose build
- name: Start dummy server
run: cd test && docker-compose up -d

- name: Prpare repos
run: |
mv ${GITHUB_WORKSPACE} /tmp/orig
git clone http://localhost/repos/foo.git ${GITHUB_WORKSPACE}
mv /tmp/orig ${GITHUB_WORKSPACE}/.bloom-release-action
- name: Run bloom-release-action
uses: ./.bloom-release-action
with:
ros_distro: noetic
github_token_bloom: dummy
github_user: dummy
git_email: dummy@dummy
repository: foo
open_pr: true
env:
ROSDISTRO_INDEX_URL: http://${{ steps.ip.outputs.ip }}/raw/rosdistro/index-v4.yaml

- name: Check release repo
working-directory: /tmp
run: |
git clone http://localhost/repos/foo-release.git
cd foo-release
git show upstream/0.0.1
8 changes: 8 additions & 0 deletions test/40-start-fastcgi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

addgroup nginx www-data

su - fcgiwrap -s /bin/sh -c "
umask 002
fcgiwrap -s unix:/var/run/fcgiwrap/socket
" &
38 changes: 38 additions & 0 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM nginx:1.21-alpine

RUN apk add --no-cache \
fcgiwrap \
git \
git-daemon \
gzip \
make

COPY cache /usr/share/nginx/html/cache
RUN make -C /usr/share/nginx/html/cache
COPY repos /usr/share/nginx/html/raw

COPY 40-start-fastcgi.sh /docker-entrypoint.d
COPY default.conf /etc/nginx/conf.d

RUN git config --global user.email "[email protected]" \
&& git config --global user.name "Your Name"

COPY repos /repos
WORKDIR /repos

RUN for repo in *; \
do \
git -C ${repo} init; \
git -C ${repo} add .; \
git -C ${repo} commit -m "Initial"; \
if [ ${repo} = "foo" ]; \
then \
git -C ${repo} tag 0.0.1; \
git -C ${repo} push origin 0.0.1; \
fi; \
git -C ${repo} config core.bare true; \
git -C ${repo} config http.receivepack true; \
mv ${repo}/.git ${repo}.git; \
chown -R fcgiwrap:www-data ${repo}.git; \
rm -rf ${repo}; \
done
2 changes: 2 additions & 0 deletions test/cache/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hoge-cache.yaml.gz: hoge-cache.yaml
cat $< | gzip > $@
11 changes: 11 additions & 0 deletions test/cache/hoge-cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
distribution_file:
- release_platforms:
ubuntu: [xenial]
repositories:
foo: {release: {tags: {release: 'release/noetic/{package}/{version}'}, url: 'http://localhost/repos/foo-release.git', version: 0.0.0-0}, source: {type: git, url: 'http://localhost/repos/foo.git', version: noetic}, status: maintained}
name: noetic
release_package_xmls:
foo: <?xml version="1.0" ?><?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?><package format="3"><name>foo</name><version>0.0.0</version><description>Dummy</description><maintainer email="[email protected]">Dummy</maintainer><license>Dummy</license><buildtool_depend>catkin</buildtool_depend></package>
source_repo_package_xmls: {}
type: cache
version: 2
19 changes: 19 additions & 0 deletions test/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server {
listen 80;

root /repos;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

location ~ /repos(/.*) {
fastcgi_pass unix:/var/run/fcgiwrap/socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /repos;
fastcgi_param PATH_INFO $1;
}
}
7 changes: 7 additions & 0 deletions test/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3.5'
services:
bloom-test:
image: bloom-test
build: .
ports:
- "80:80"
1 change: 1 addition & 0 deletions test/repos/foo-release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Release of foo
28 changes: 28 additions & 0 deletions test/repos/foo-release/tracks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
release_repo_url: http://localhost/repos/foo-release.git
tracks:
noetic:
actions:
- bloom-export-upstream :{vcs_local_uri} :{vcs_type} --tag :{release_tag} --display-uri
:{vcs_uri} --name :{name} --output-dir :{archive_dir_path}
- git-bloom-import-upstream :{archive_path} :{patches} --release-version :{version}
--replace
- git-bloom-generate -y rosrelease :{ros_distro} --source upstream -i :{release_inc}
- git-bloom-generate -y rosdebian --prefix release/:{ros_distro} :{ros_distro}
-i :{release_inc} --os-name ubuntu
- git-bloom-generate -y rosdebian --prefix release/:{ros_distro} :{ros_distro}
-i :{release_inc} --os-name debian --os-not-required
- git-bloom-generate -y rosrpm --prefix release/:{ros_distro} :{ros_distro} -i
:{release_inc} --os-name fedora
- git-bloom-generate -y rosrpm --prefix release/:{ros_distro} :{ros_distro} -i
:{release_inc} --os-name rhel
devel_branch: master
last_version: 0.0.0
name: upstream
patches: null
release_inc: '0'
release_repo_url: http://localhost/repos/foo-release.git
release_tag: :{version}
ros_distro: noetic
vcs_type: git
vcs_uri: http://localhost/repos/foo.git
version: :{auto}
5 changes: 5 additions & 0 deletions test/repos/foo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.1.3)
project(foo)

find_package(catkin REQUIRED)
catkin_package()
10 changes: 10 additions & 0 deletions test/repos/foo/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" ?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>foo</name>
<version>0.0.1</version>
<description>Dummy</description>
<maintainer email="[email protected]">Dummy</maintainer>
<license>Dummy</license>
<buildtool_depend>catkin</buildtool_depend>
</package>
13 changes: 13 additions & 0 deletions test/repos/rosdistro/index-v4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%YAML 1.1
# ROS index file
# see REP 153: http://ros.org/reps/rep-0153.html
---
distributions:
noetic:
distribution: [noetic/distribution.yaml]
distribution_cache: http://localhost/cache/noetic-cache.yaml.gz
distribution_status: active
distribution_type: ros1
python_version: 3
type: index
version: 4
41 changes: 41 additions & 0 deletions test/repos/rosdistro/noetic/distribution.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
%YAML 1.1
# ROS distribution file
# see REP 143: http://ros.org/reps/rep-0143.html
---
release_platforms:
ubuntu:
- focal
repositories:
catkin:
doc:
type: git
url: https://github.com/ros/catkin.git
version: noetic-devel
release:
tags:
release: release/noetic/{package}/{version}
url: https://github.com/ros-gbp/catkin-release.git
version: 0.8.10-1
source:
test_pull_requests: true
type: git
url: https://github.com/ros/catkin.git
version: noetic-devel
status: maintained
foo:
doc:
type: git
url: http://localhost/repos/foo.git
version: master
release:
tags:
release: release/noetic/{package}/{version}
url: http://localhost/repos/foo-release.git
version: 0.0.0-0
source:
type: git
url: http://localhost/repos/foo.git
version: master
status: maintained
type: distribution
version: 2

0 comments on commit 2f032cf

Please sign in to comment.