Skip to content

Commit

Permalink
Release 0.9.1 (#10)
Browse files Browse the repository at this point in the history
* Separate test for debs; Bump version to 0.9.1

* Clone repository during deb build

\* Use runner.debug to increase verbosity; fix full-validation runner allocation

* Consistent testing invocation through makefile

* Don't use poetry in automation

* Use different artifact names based on use of license; enable masquerading in the test docker networks
  • Loading branch information
asorbini authored Apr 16, 2024
1 parent 0cb90a0 commit ec4016c
Show file tree
Hide file tree
Showing 32 changed files with 881 additions and 498 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.*
venv
poetry.lock

build
134 changes: 88 additions & 46 deletions .github/workflows/_deb_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ concurrency:
permissions:
packages: read

env:
DEBUG: y
VERBOSITY: debug

jobs:
config:
runs-on: ubuntu-latest
outputs:
BUILDER_TAG: ${{ steps.config.outputs.BUILDER_TAG }}
REF_TAG: ${{ steps.config.outputs.REF_TAG }}
DEB_ARTIFACT: ${{ steps.config.outputs.DEB_ARTIFACT }}
DEB_BUILDER_TAG: ${{ steps.config.outputs.DEB_BUILDER_TAG }}
RUNNER: ${{ steps.config.outputs.RUNNER }}
TEST_IMAGE: ${{ steps.config.outputs.TEST_IMAGE }}
TEST_ARTIFACT: ${{ steps.config.outputs.TEST_ARTIFACT }}
TEST_DATE: ${{ steps.config.outputs.TEST_DATE }}
TEST_ID: ${{ steps.config.outputs.TEST_ID }}
TEST_IMAGE: ${{ steps.config.outputs.TEST_IMAGE }}
TEST_RUNNER_ARTIFACT: ${{ steps.config.outputs.TEST_RUNNER_ARTIFACT }}
steps:
- name: Clone uno
uses: actions/checkout@v4
Expand All @@ -61,16 +60,31 @@ jobs:
runner='["self-hosted", "linux", "arm64", "rpi5"]'
;;
esac
builder_tag=$(echo ${{inputs.base-tag}} | tr : - | tr / -)
ref_tag=$(echo ${{ github.ref_name }} | tr / -)
test_id=$(date +%Y%m%d-%H%M%S)
test_artifact=uno-test-deb-${builder_tag}-${ref_tag}-${{inputs.platform}}__${test_id}
case "${{github.ref_type}}" in
tag)
image_version=${{github.ref_name}}
;;
*)
sha_short=$(cd src/uno && git rev-parse --short HEAD)
image_version=${{github.ref_name}}@${sha_short}
;;
esac
image_version="$(echo ${image_version} | tr / -)"
deb_builder_tag=$(echo ${{inputs.base-tag}} | tr : - | tr / -)
test_date=$(date +%Y%m%d-%H%M%S)
test_id=deb-${deb_builder_tag}-${{ inputs.platform }}__${image_version}
test_artifact=uno-test-${test_id}__${test_date}
test_runner_artifact=uno-runner-${deb_builder_tag}-${{ inputs.platform }}__${image_version}__${test_date}
deb_artifact=uno-deb-${deb_builder_tag}-${{ inputs.platform }}__${image_version}__${test_date}
(
echo RUNNER=${runner}
echo BUILDER_TAG=${builder_tag}
echo REF_TAG=${ref_tag}
echo TEST_IMAGE=mentalsmash/uno-test-runner:latest
echo DEB_BUILDER_TAG=${deb_builder_tag}
echo DEB_ARTIFACT=${deb_artifact}
echo TEST_ARTIFACT=${test_artifact}
echo TEST_DATE=${test_date}
echo TEST_ID=${test_id}
echo TEST_IMAGE=mentalsmash/uno-test-runner:latest
echo TEST_RUNNER_ARTIFACT=${test_runner_artifact}
) >> ${GITHUB_OUTPUT}
build-packages:
Expand All @@ -83,14 +97,6 @@ jobs:
path: src/uno
submodules: true

- name: Clone support files
uses: actions/checkout@v4
with:
repository: mentalsmash/uno-ci
token: ${{ secrets.UNO_CI_PAT }}
ref: master
path: src/uno-ci

- name: Log in to GitHub
uses: docker/login-action@v3
with:
Expand All @@ -103,23 +109,75 @@ jobs:
make -C src/uno changelog
make -C src/uno debuild
env:
DEB_BUILDER: ghcr.io/mentalsmash/uno-ci-debian-builder:${{ needs.config.outputs.BUILDER_TAG }}
DEB_BUILDER: ghcr.io/mentalsmash/uno-ci-debian-builder:${{ needs.config.outputs.DEB_BUILDER_TAG }}

- name: Upload debian packages
uses: actions/upload-artifact@v4
with:
name: uno-${{inputs.platform}}-${{needs.config.outputs.BUILDER_TAG}}
name: ${{ needs.config.outputs.DEB_ARTIFACT }}
path: src/uno/debian-dist/*
if: always()

- name: Upload test runner
uses: actions/upload-artifact@v4
with:
name: ${{ needs.config.outputs.TEST_RUNNER_ARTIFACT }}
path: src/uno/dist/bundle/default/runner

- name: Fix permissions
run: |
docker run --rm \
-v $(pwd)/src/uno:/uno \
ghcr.io/mentalsmash/uno-ci-debian-builder:${{ needs.config.outputs.BUILDER_TAG }} \
ghcr.io/mentalsmash/uno-ci-debian-builder:${{ needs.config.outputs.DEB_BUILDER_TAG }} \
chown -R $(id -u):$(id -g) /uno
if: always()

test-packages:
needs:
- config
- build-packages
runs-on: ${{ fromJson(needs.config.outputs.RUNNER) }}
env:
DEB_TESTER: ${{ needs.config.outputs.TEST_IMAGE }}
FIX_DIR: ${{ github.workspace }}
RTI_LICENSE_FILE: ${{ github.workspace }}/src/uno-ci/resource/rti/rti_license.dat
TEST_DATE: ${{ needs.config.outputs.TEST_DATE }}
TEST_ID: ${{ needs.config.outputs.TEST_ID }}
TEST_IMAGE: ${{ needs.config.outputs.TEST_IMAGE }}
steps:
- name: Clone uno
uses: actions/checkout@v4
with:
path: src/uno
submodules: true

- name: Clone support files
uses: actions/checkout@v4
with:
repository: mentalsmash/uno-ci
token: ${{ secrets.UNO_CI_PAT }}
ref: master
path: src/uno-ci

- name: Download runner artifact
uses: actions/download-artifact@v4
with:
pattern: ${{ needs.config.outputs.TEST_RUNNER_ARTIFACT }}

- name: Download debian packages artifact
uses: actions/download-artifact@v4
with:
pattern: ${{ needs.config.outputs.DEB_ARTIFACT }}

- name: Move artifacts in place
run: |
mkdir -p src/uno/dist/bundle/default/runner
mv -v ${{ needs.config.outputs.TEST_RUNNER_ARTIFACT }}/* \
src/uno/dist/bundle/default/runner/
mkdir -p src/uno/debian-dist
mv -v ${{ needs.config.outputs.DEB_ARTIFACT }}/* \
src/uno/debian-dist/
- name: Build tester image
uses: docker/build-push-action@v5
with:
Expand All @@ -130,38 +188,22 @@ jobs:
build-args: |
BASE_IMAGE=${{ inputs.base-tag }}
- name: Setup integration tests
run: |
python3 -m venv venv
. venv/bin/activate
pip3 install -U pip setuptools
pip3 install -U -e src/uno
cp src/uno-ci/resource/rti/rti_license.dat rti_license.dat
- name: Run integration tests
run: |
. venv/bin/activate
pytest -s -v --junit-xml=test-results/uno-test-results-integration-${{ needs.config.outputs.REF_TAG }}.xml \
src/uno/test/integration
make -C src/uno debtest
env:
DEV: y
RTI_LICENSE_FILE: ${{ github.workspace }}/rti_license.dat
TEST_IMAGE: ${{ needs.config.outputs.TEST_IMAGE }}
TEST_RUNNER: runner
DEBUG: ${{ runner.debug }}

- name: Restore permissions changed by integration tests
if: always()
run: |
docker run --rm \
-v $(pwd):/workspace \
${{ needs.config.outputs.TEST_IMAGE }} \
fix-root-permissions $(id -u):$(id -g) /workspace
make -C src/uno fix-file-ownership
# Always collect and upload available test results
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: ${{ needs.config.outputs.TEST_ARTIFACT }}
path: test-results/*
path: src/uno/test-results/*
if: always()

6 changes: 3 additions & 3 deletions .github/workflows/_install_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ jobs:
src/uno/test/install
- name: Restore permissions changed by tests
if: ${{ always() }}
if: always()
run: |
docker run --rm \
-v $(pwd):/workspace \
${{inputs.tag}} \
fix-root-permissions $(id -u):$(id -g) /workspace
fix-file-ownership $(id -u):$(id -g) /workspace
- name: Upload test results
uses: actions/upload-artifact@v4
if: ${{ always() }}
if: always()
with:
name: ${{ needs.test-config.outputs.TEST_ARTIFACT }}
path: test-results/*
16 changes: 8 additions & 8 deletions .github/workflows/_release_badges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ jobs:
version=${sha_short}
color_version=orange
tag=nightly
badge_default_version=29b57b0427def87cc3ef4ab81c956c29
badge_default_base=2d53344e1ccfae961665e08432f18113
badge_static_version=d73e338805c7d2c348a2d7149a66f66c
badge_static_base=373e55438055b1222c9937797c949f9b
badge_default_version=e7aab205f782cc0c6f394a2fece90509
badge_default_base=8f31c46dcfd0543b42f356e5b1c6c2c8
badge_static_version=b310f08c34f051846877aeb59b0be311
badge_static_base=b0e38a84eb8679d5212e162fbb616773
;;
tag)
version=${{github.ref_name}}
color_version=green
tag=latest
badge_default_version=e7aab205f782cc0c6f394a2fece90509
badge_default_base=8f31c46dcfd0543b42f356e5b1c6c2c8
badge_static_version=b310f08c34f051846877aeb59b0be311
badge_static_base=b0e38a84eb8679d5212e162fbb616773
badge_default_version=29b57b0427def87cc3ef4ab81c956c29
badge_default_base=2d53344e1ccfae961665e08432f18113
badge_static_version=d73e338805c7d2c348a2d7149a66f66c
badge_static_base=373e55438055b1222c9937797c949f9b
;;
esac
(
Expand Down
17 changes: 1 addition & 16 deletions .github/workflows/_release_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,9 @@ jobs:
path: src/uno
submodules: true

- name: Bootstrap dev dependencies with poetry
run: |
python3 -m venv poetry-venv
. poetry-venv/bin/activate
pip install -U poetry
deactivate
cd src/uno
${GITHUB_WORKSPACE}/poetry-venv/bin/poetry install --with=dev
- name: Validate code
run: |
. src/uno/.venv/bin/activate
ruff check
- name: Validate code format
run: |
. src/uno/.venv/bin/activate
ruff format --check
make -C src/uno code-check
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
Loading

0 comments on commit ec4016c

Please sign in to comment.