generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Build and Test workflow Add Build and Test script Add Container Structure Test definition Signed-off-by: Jacob Woffenden <[email protected]>
- Loading branch information
Jacob Woffenden
committed
Mar 5, 2024
1 parent
b0d9d9c
commit e1c76c0
Showing
6 changed files
with
74 additions
and
9 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,26 @@ | ||
--- | ||
name: Build and Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
build-and-test: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Build and Test | ||
id: build_and_test | ||
shell: bash | ||
run: | | ||
bash scripts/build-and-test.sh |
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
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,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
IMAGE_TAG="analytical-platform.service.justice.gov.uk/ingestion-scanner:local" | ||
CONTAINER_STRUCTURE_TEST_IMAGE="gcr.io/gcp-runtimes/container-structure-test:latest" | ||
|
||
if [[ "${REMOTE_CONTAINERS}" ]] && [[ "$(uname -m)" == "aarch64" ]]; then | ||
echo "(⚠) Looks like you're running in a dev container on Apple Silicon." | ||
echo "(⚠) This script builds linux/amd64 images which might take a long time or even fail." | ||
export PLATFORM_FLAG="--platform linux/amd64" | ||
fi | ||
# shellcheck disable=SC2086 | ||
# special case for PLATFORM_FLAG as it can't parse double quotes | ||
docker build ${PLATFORM_FLAG} --file Dockerfile --tag "${IMAGE_TAG}" . | ||
|
||
echo "Running container structure test for [ ${IMAGE_TAG} ]" | ||
|
||
# shellcheck disable=SC2086 | ||
# special case for PLATFORM_FLAG as it can't parse double quotes | ||
docker run --rm ${PLATFORM_FLAG} \ | ||
--volume /var/run/docker.sock:/var/run/docker.sock \ | ||
--volume "${PWD}:/workspace" \ | ||
--workdir /workspace \ | ||
"${CONTAINER_STRUCTURE_TEST_IMAGE}" \ | ||
test --image "${IMAGE_TAG}" --config "/workspace/test/container-structure-test.yml" |
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,8 @@ | ||
--- | ||
schemaVersion: 2.0.0 | ||
|
||
commandTests: | ||
- name: "aws" | ||
command: "aws" | ||
args: ["--version"] | ||
expectedOutput: ["aws-cli/2.15.23.*"] |