Verified Commit 1a6ed8ab authored by Andrej Shadura's avatar Andrej Shadura
Browse files

Add a stage where we actually test things and prove that osc dput works



Signed-off-by: Andrej Shadura's avatarAndrej Shadura <andrew.shadura@collabora.co.uk>
parent 6e92b732
Pipeline #20950 failed with stages
in 2 minutes and 16 seconds
......@@ -20,8 +20,81 @@ build:
paths:
- _build
test:
stage: test
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$OSC_API_URL == null || $OSC_USERNAME == null || $OSC_PASSWORD == null'
when: never
- when: on_success
needs:
- build
script:
- apt install -y ./_build/*deb dpkg-dev
- mkdir -p "$HOME"
- |
cat > ~/.oscrc <<EOF
[general]
apiurl = ${OSC_API_URL}
[${OSC_API_URL}]
user = ${OSC_USERNAME}
pass = ${OSC_PASSWORD}
EOF
- ORIG_PROJECT=collabora:ci:osc-dput
- PROJECT="$ORIG_PROJECT:branches:$CI_JOB_ID"
- TEST_PACKAGE=dash
- PACKAGE="$(dpkg-parsechangelog -SSource)"
- ": Going to test $PACKAGE."
- ": Check whether osc is usable"
- osc ls "$ORIG_PROJECT"
- ": Check whether osc dput is usable"
- osc dput --help
- ": Create a new branch"
- osc --debug branch -N -f "$ORIG_PROJECT" empty "$PROJECT"
- ": Testing the initial upload"
- osc --debug dput "$PROJECT" _build/*dsc | tee log
- grep -q "Committed revision" log && echo "Commit as expected"
- osc --debug dput "$PROJECT" _build/*dsc | tee log
- grep -q "No changes" log && echo "Skipped committing as expected"
- ": Testing the repeated upload with more files added"
- osc --debug dput "$PROJECT" _build/*changes | tee log
- grep -q "Committed revision" log && echo "Commit as expected"
- ": Verify that random extra files from the previous revision do not break uploads"
- ": This test is expected to fail"
- osc co "$PROJECT" "$PACKAGE"
- cd "$PROJECT/$PACKAGE"
- touch foobar.buildinfo
- osc add foobar.buildinfo
- ": We remove the .dsc file to make sure there is at least one change in the new upload"
- osc rm *.dsc
- osc --debug commit -m "foo"
- cd ../..
- (osc --debug dput "$PROJECT" _build/*changes || true) | tee log
- grep -q "Committed revision" log && echo "Commit as expected"
- ": Verify we can replace a package completely"
- osc co "$ORIG_PROJECT" "$TEST_PACKAGE"
- cd "$PROJECT/$PACKAGE"
- osc up
- osc rm *
- osc --debug commit -m "delete everything"
- cp ../../"$ORIG_PROJECT/$TEST_PACKAGE"/* .
- osc add *
- osc --debug commit -m "commit $TEST_PACKAGE instead"
- cd ../..
- osc ls -l "$PROJECT" "$PACKAGE"
- osc --debug dput "$PROJECT" _build/*changes | tee log
- grep -q "Committed revision" log && echo "Commit as expected"
- osc ls "$PROJECT"
- osc ls -l "$PROJECT" "$PACKAGE"
- ": Remove the resulting package"
- osc --debug rdelete -m DELETE "$PROJECT" "$PACKAGE"
- ": Remove the temporary branch"
- osc --debug rdelete -m DELETE -r "$PROJECT"
codestyle:
stage: test
needs: []
allow_failure: true
script:
- apt install -y flake8
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment