-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/pip/zstandard-0.23.0
- Loading branch information
Showing
21 changed files
with
1,214 additions
and
1,530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,15 @@ on: | |
|
||
jobs: | ||
pytest_with_coverage: | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
test_base: | ||
- ubuntu-18.04 | ||
- ubuntu-20.04 | ||
- ubuntu-22.04 | ||
steps: | ||
- name: Checkout commit | ||
uses: actions/checkout@v4 | ||
|
@@ -26,20 +33,23 @@ jobs: | |
fetch-depth: 0 | ||
- name: Build ota-test_base docker image | ||
run: | | ||
docker compose -f docker/docker-compose_tests.yml build | ||
docker compose -f docker/docker-compose_tests.yml build tester-${{ matrix.test_base }} | ||
- name: Execute pytest with coverage trace under ota-test_base container | ||
run: | | ||
mkdir -p test_result | ||
docker compose -f docker/docker-compose_tests.yml up --abort-on-container-exit | ||
docker compose -f docker/docker-compose_tests.yml run --rm tester-${{ matrix.test_base }} | ||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
continue-on-error: true | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
if: ${{ matrix.test_base == 'ubuntu-22.04' }} | ||
|
||
# export the coverage report to the comment! | ||
- name: Add coverage report to PR comment | ||
continue-on-error: true | ||
uses: MishaKav/[email protected] | ||
with: | ||
pytest-xml-coverage-path: test_result/coverage.xml | ||
junitxml-path: test_result/pytest.xml | ||
if: ${{ matrix.test_base == 'ubuntu-22.04' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
ARG UBUNTU_BASE | ||
|
||
# | ||
# ------ stage 1: prepare base image ------ # | ||
# | ||
|
||
FROM ${UBUNTU_BASE} AS builder | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV SPECIAL_FILE="path;adf.ae?qu.er\y=str#fragファイルement" | ||
|
||
# special treatment to the ota-image: create file that needs url escaping | ||
# NOTE: include special identifiers #?; into the pathname | ||
RUN echo -n "${SPECIAL_FILE}" > "/${SPECIAL_FILE}" | ||
|
||
# install required packages | ||
RUN set -eux; \ | ||
apt-get update -qq; \ | ||
apt-get install -y linux-image-generic; \ | ||
apt-get clean; \ | ||
rm -rf \ | ||
/tmp/* \ | ||
/var/lib/apt/lists/* \ | ||
/var/tmp/* \ | ||
|
||
# | ||
# ------ stage 2: prepare test environment ------ # | ||
# | ||
ARG UBUNTU_BASE | ||
|
||
FROM ${UBUNTU_BASE} | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
ENV OTA_METADATA_REPO="https://github.com/tier4/ota-metadata" | ||
ENV OTA_IMAGE_SERVER_ROOT="/ota-image" | ||
ENV OTA_IMAGE_DIR="${OTA_IMAGE_SERVER_ROOT}/data" | ||
ENV CERTS_DIR="/certs" | ||
ENV SPECIAL_FILE="path;adf.ae?qu.er\y=str#fragファイルement" | ||
|
||
# install required packages | ||
RUN set -eux; \ | ||
apt-get update -qq; \ | ||
apt-get install -y -qq --no-install-recommends \ | ||
python3-minimal \ | ||
python3-pip \ | ||
python3-venv \ | ||
python3-dev \ | ||
libcurl4-openssl-dev \ | ||
libssl-dev \ | ||
gcc \ | ||
wget \ | ||
git \ | ||
python3.8-venv; \ | ||
apt-get install -y -qq linux-image-generic; \ | ||
apt-get clean | ||
|
||
# install hatch to the system | ||
RUN set -eux; \ | ||
python3.8 -m pip install --no-cache-dir -q -U pip; \ | ||
python3.8 -m pip install --no-cache-dir -U hatch | ||
|
||
WORKDIR ${OTA_IMAGE_SERVER_ROOT} | ||
|
||
COPY --from=builder / /${OTA_IMAGE_DIR} | ||
|
||
# generate test certs and sign key | ||
COPY --chmod=755 ./tests/keys/gen_certs.sh /tmp/certs/ | ||
RUN set -eux; \ | ||
mkdir -p "${CERTS_DIR}"; \ | ||
pushd /tmp/certs; \ | ||
./gen_certs.sh; \ | ||
cp ./* "${CERTS_DIR}"; \ | ||
popd | ||
|
||
# build the test OTA image | ||
RUN set -eux; \ | ||
cp "${CERTS_DIR}"/sign.key sign.key; \ | ||
cp "${CERTS_DIR}"/sign.pem sign.pem; \ | ||
git clone ${OTA_METADATA_REPO}; \ | ||
python3.8 -m venv ota-metadata/.venv; \ | ||
source ota-metadata/.venv/bin/activate; \ | ||
python3.8 -m pip install --no-cache-dir -U pip; \ | ||
python3.8 -m pip install --no-cache-dir -q \ | ||
-r ota-metadata/metadata/ota_metadata/requirements.txt; \ | ||
# patch the ignore files | ||
echo "" > ota-metadata/metadata/ignore.txt; \ | ||
python3.8 ota-metadata/metadata/ota_metadata/metadata_gen.py \ | ||
--target-dir data \ | ||
--compressed-dir data.zst \ | ||
--ignore-file ota-metadata/metadata/ignore.txt; \ | ||
python3.8 ota-metadata/metadata/ota_metadata/metadata_sign.py \ | ||
--sign-key sign.key \ | ||
--cert-file sign.pem \ | ||
--persistent-file ota-metadata/metadata/persistents.txt \ | ||
--rootfs-directory data \ | ||
--compressed-rootfs-directory data.zst; \ | ||
cp ota-metadata/metadata/persistents.txt . | ||
|
||
# cleanup | ||
RUN set -eux; \ | ||
apt-get clean; \ | ||
rm -rf \ | ||
/tmp/* \ | ||
/var/lib/apt/lists/* \ | ||
/var/tmp/* \ | ||
ota-metadata | ||
|
||
# copy and setup the entry_point.sh | ||
COPY ./docker/test_base/entry_point.sh /entry_point.sh | ||
RUN chmod +x /entry_point.sh | ||
|
||
ENTRYPOINT [ "/entry_point.sh" ] |
Oops, something went wrong.