-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: verify PRs against the e2e tests (#135)
- Loading branch information
1 parent
9e40ecd
commit 9c95bd5
Showing
2 changed files
with
90 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CI (global trustify CI) | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "main" | ||
workflow_call: | ||
|
||
concurrency: | ||
group: ci-global-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-and-upload-for-global-ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: save trustd image | ||
run: | | ||
docker build . -t ghcr.io/trustification/trustd:pr-test -f Dockerfile.server | ||
docker save -o /tmp/trustd.tar ghcr.io/trustification/trustd:pr-test | ||
- name: Upload trustd image as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: trustd | ||
path: /tmp/trustd.tar | ||
retention-days: 1 | ||
|
||
run-global-ci: | ||
needs: build-and-upload-for-global-ci | ||
uses: trustification/trustify-ci/.github/workflows/global-ci.yml@main | ||
with: | ||
artifact: trustd | ||
server_image: ghcr.io/trustification/trustd:pr-test | ||
run_api_tests: false |
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,51 @@ | ||
###################################################################### | ||
# UI | ||
###################################################################### | ||
FROM registry.access.redhat.com/ubi9/nodejs-20:latest AS ui-source | ||
USER 1001 | ||
COPY --chown=1001 . . | ||
RUN npm install -g npm@9 | ||
RUN npm clean-install --ignore-scripts && npm run build && npm run dist | ||
|
||
###################################################################### | ||
# Prepare server | ||
###################################################################### | ||
FROM registry.access.redhat.com/ubi9/ubi:latest AS server-source | ||
ARG server_branch="main" | ||
ARG server_commit | ||
|
||
RUN dnf install git -y | ||
RUN git clone https://github.com/trustification/trustify.git --branch ${server_branch} /trustify/ | ||
RUN cd /trustify/ && if [ -n "${commit}" ]; then git checkout -b commit-branch ${server_commit}; fi | ||
RUN sed -i 's/trustify-ui = { git = "https:\/\/github.com\/trustification\/trustify-ui.git", tag = "static-main" }/trustify-ui = { path = "..\/trustify-ui\/crate" }/g' /trustify/Cargo.toml | ||
|
||
###################################################################### | ||
# Build server | ||
###################################################################### | ||
FROM registry.access.redhat.com/ubi9/ubi:latest AS server-builder | ||
|
||
# Dependencies | ||
RUN dnf install -y openssl-devel gcc | ||
|
||
RUN mkdir /stage/ && \ | ||
dnf install --installroot /stage/ --setop install_weak_deps=false --nodocs -y zlib openssl && \ | ||
dnf clean all --installroot /stage/ | ||
|
||
# Setup Rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
ENV PATH=${PATH}:/root/.cargo/bin | ||
RUN rustup target add $(uname -m)-unknown-linux-gnu | ||
|
||
# Build source code | ||
COPY --from=ui-source /opt/app-root/src/ /code/trustify-ui/ | ||
COPY --from=server-source /trustify/ /code/trustify/ | ||
RUN cd /code/trustify/ && \ | ||
cargo build --no-default-features --release --target=$(uname -m)-unknown-linux-gnu && \ | ||
find /code/trustify/target/ -name "trustd" -exec cp -av {} /stage/usr/local/bin \; | ||
|
||
###################################################################### | ||
# Builder runner | ||
###################################################################### | ||
FROM registry.access.redhat.com/ubi9/ubi-micro:latest AS server-runner | ||
COPY --from=server-builder /stage/ . | ||
ENTRYPOINT ["/usr/local/bin/trustd"] |