Skip to content

Commit

Permalink
Do not install ci scripts into bin/
Browse files Browse the repository at this point in the history
  • Loading branch information
felixsch committed Feb 6, 2024
1 parent ebed7b5 commit 7c2ec35
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 26 deletions.
51 changes: 44 additions & 7 deletions .github/workflows/features.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
---
name: feature tests

name: RMT feature tests
on:
pull_request:
branches: [master]

env:
SOURCE: /usr/src/rmt-server
SCC_USERNAME: ${{ secrets.SCC_USERNAME }}
SCC_PASSWORD: ${{ secrets.SCC_PASSWORD }}
SYSTEM_UUID: ${{ secrets.SYSTEM_UUID }}

# Within containters Github Actions does create a bridged network exposing
# the service named after its label
MYSQL_HOST: mysql

jobs:
feature-tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: /usr/src/rmt-server
container:
image: registry.opensuse.org/systemsmanagement/scc/containers/15.5/rmt-ci-container:latest
Expand All @@ -35,14 +44,42 @@ jobs:
with:
fetch-depth: 0

- name: build rpm
- name: move source to /usr/src/rmt-server
run: |
rmt-build-rpm
[ -d $SOURCE ] && rm -r $SOURCE
cp -r $GITHUB_WORKSPACE $SOURCE
# - name: cache vendor directory
# id: vendor-cache
# uses: actions/cache@v4
# with:
# path: ${{ env.SOURCE }}/vendor/
# key: vendor-cache

# - name: update vendor cache
# if: steps.vendor-cache.outputs.cache-hit != 'true'
# run: |
# bundle install
# bundle package --all

# - name: update gem depdendencies
# run: |
# bundle install

- name: build RPM package
run: |
bash ci/rmt-build-rpm
- name: gather RPM build artifacts
uses: actions/upload-artifact@v4
with:
name: rmt-server-rpms
path: ${{ env.SOURCE }}/tmp/artifacts/*.rpm

- name: configure rmt
- name: configure RMT to run feature tests
run: |
rmt-configure
bash ci/rmt-configure
- name: run feature tests
run: |
rmt-run-feature-tests
bash ci/rmt-run-feature-tests
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ clean:
rm -rf $(NAME)-$(VERSION)/

man:
bundle exec ronn --roff --pipe --manual RMT MANUAL.md > rmt-cli.8 && gzip -f rmt-cli.8
ronn --roff --pipe --manual RMT MANUAL.md > rmt-cli.8 && gzip -f rmt-cli.8
mv rmt-cli.8.gz package/obs

dist: clean man
Expand Down
18 changes: 1 addition & 17 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,5 @@ RUN zypper --non-interactive in make chrpath fdupes gcc libcurl-devel libffi-dev
RUN update-alternatives --install /usr/bin/bundle bundle /usr/bin/bundle.ruby2.5 5 && \
update-alternatives --install /usr/bin/bundler bundler /usr/bin/bundler.ruby2.5 5

VOLUME /usr/src/rmt-server
VOLUME /usr/

ARG SCC_USERNAME
ARG SCC_PASSWORD

# Prepare ruby environment
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES 1

# Add rmt ci/development scripts
RUN mkdir -p /usr/src/rmt-server /usr/local/bin

COPY rmt-build-rpm /usr/local/bin/
COPY rmt-configure /usr/local/bin/
COPY rmt-console /usr/local/bin/
COPY rmt-run-feature-tests /usr/local/bin/

RUN mkdir /usr/src/rmt-server
WORKDIR /usr/src/rmt-server
3 changes: 2 additions & 1 deletion ci/rmt-build-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pushd $SOURCE
make dist
cp $SOURCE/package/obs/rmt-server-$VERSION.tar.bz2 $ARTIFACT_DIR
popd
group
groupend

group "prepare build environment (in $BUILD_DIR)"
pushd $BUILD_DIR
Expand All @@ -38,5 +38,6 @@ group "build rmt-server-$VERSION.x86_64.rpm"
pushd $BUILD_DIR
rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --undefine _enable_debug_packages SOURCES/rmt-server.spec
cp -r RPMS/x86_64/rmt-server-$VERSION*.rpm $ARTIFACT_DIR/
cp -r RPMS/x86_64/rmt-server-config-$VERSION*.rpm $ARTIFACT_DIR/
popd
groupend
9 changes: 9 additions & 0 deletions ci/rmt-configure
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ MYSQL_PASSWORD=${MYSQL_PASSWORD:-rmt}
MYSQL_DATABASE=${MYSQL_DATABASE:-rmt_features}
MYSQL_PORT=${MYSQL_PORT:-3306}

# The systems uuid to use to identify this proxy (namely to not
# create a new proxy each time this is running!)
SYSTEM_UUID=${SYSTEM_UUID:-$(uuidgen)}

group() { echo "::group::$@"; }
groupend() { echo "::groupend::"; }
fail() { echo "::error::$@"; exit 1; }
Expand All @@ -34,6 +38,11 @@ if [ "x$SCC_PASSWORD" = "x" ] || [ "x$SCC_USERNAME" = "x" ]; then
fail "To correctly configure RMT environment variables \$SCC_USERNAME and \$SCC_PASSWORD are required. Check your environment!"
fi

group "setup system uuid"
mkdir -p /var/lib/rmt/
echo "$SYSTEM_UUID" > /var/lib/rmt/system_uuid
groupend

group "install rmt-server rpms"
pushd $BUILD_DIR/RPMS/x86_64
zypper --non-interactive --no-refresh install --allow-unsigned-rpm $RPMS
Expand Down

0 comments on commit 7c2ec35

Please sign in to comment.