Skip to content

Commit

Permalink
TMP test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leviathan747 committed Aug 24, 2023
1 parent c34fdf8 commit 66228ca
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 289 deletions.
306 changes: 22 additions & 284 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,300 +18,37 @@ on:


jobs:
build_aeordering:
build_and_test:
runs-on: ubuntu-latest
env:
PROJECT_NAME: AEOrdering
DOMAIN_NAME: AEOrdering
EXTRA_MASL_ARGS: '-skiptranslator Sqlite'
steps:
# Setup
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- id: lowercase
run: echo '::set-output name=DOMAIN_LOWER::'$(echo "console.log('${{ env.DOMAIN_NAME }}'.toLowerCase())" | node -)

- name: Check if files have been modified
id: check-modified
uses: tj-actions/changed-files@v29.0.0
with:
files: models/${{ env.PROJECT_NAME }}

- name: Generate MASL
run: |
mkdir -p models/${{ env.PROJECT_NAME }}/masl/${{ env.DOMAIN_NAME }}
docker run -v ${GITHUB_WORKSPACE}/models/${{ env.PROJECT_NAME }}:/root levistarrett/xtuml2masl -xf -i . -d ${{ env.DOMAIN_NAME }} -o masl
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/xtuml/${{ steps.lowercase.outputs.DOMAIN_LOWER }}

- name: Build image (prod)
uses: docker/build-push-action@v3
with:
context: models/${{ env.PROJECT_NAME }}
tags: ${{ steps.meta.outputs.tags }}
target: install-release
build-args: EXTRA_MASL_ARGS=${{ env.EXTRA_MASL_ARGS }}
push: true

- name: Run test
run: |
cd models/${{ env.PROJECT_NAME }}
docker compose -f docker-compose.test.yml build --no-cache
docker compose -f docker-compose.test.yml up --force-recreate
- name: Archive test results
uses: actions/upload-artifact@v3
with:
name: ${{ steps.lowercase.outputs.DOMAIN_LOWER }}-results
path: models/**/test_results/*.json

build_aereception:
runs-on: ubuntu-latest
env:
PROJECT_NAME: AEReception
DOMAIN_NAME: AEReception
EXTRA_MASL_ARGS: '-skiptranslator Sqlite'
steps:
# Setup
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- id: lowercase
run: echo '::set-output name=DOMAIN_LOWER::'$(echo "console.log('${{ env.DOMAIN_NAME }}'.toLowerCase())" | node -)

- name: Check if files have been modified
id: check-modified
uses: tj-actions/changed-files@v29.0.0
with:
files: models/${{ env.PROJECT_NAME }}

- name: Generate MASL
run: |
mkdir -p models/${{ env.PROJECT_NAME }}/masl/${{ env.DOMAIN_NAME }}
docker run -v ${GITHUB_WORKSPACE}/models/${{ env.PROJECT_NAME }}:/root levistarrett/xtuml2masl -xf -i . -d ${{ env.DOMAIN_NAME }} -o masl
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/xtuml/${{ steps.lowercase.outputs.DOMAIN_LOWER }}

- name: Build image (prod)
uses: docker/build-push-action@v3
with:
context: models/${{ env.PROJECT_NAME }}
tags: ${{ steps.meta.outputs.tags }}
target: install-release
build-args: EXTRA_MASL_ARGS=${{ env.EXTRA_MASL_ARGS }}
push: true

- name: Run test
run: |
cd models/${{ env.PROJECT_NAME }}
docker compose -f docker-compose.test.yml build --no-cache
docker compose -f docker-compose.test.yml up --force-recreate
- name: Archive test results
uses: actions/upload-artifact@v3
with:
name: ${{ steps.lowercase.outputs.DOMAIN_LOWER }}-results
path: models/**/test_results/*.json

build_aesequencedc:
runs-on: ubuntu-latest
env:
PROJECT_NAME: SequenceVerificationDataCentric
DOMAIN_NAME: AESequenceDC
EXTRA_MASL_ARGS: '-skiptranslator Sqlite'
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- id: lowercase
run: echo '::set-output name=DOMAIN_LOWER::'$(echo "console.log('${{ env.DOMAIN_NAME }}'.toLowerCase())" | node -)

- name: Check if files have been modified
id: check-modified
uses: tj-actions/changed-files@v29.0.0
with:
files: models/${{ env.PROJECT_NAME }}
- run: bin/populate.sh

- name: Generate MASL
run: |
mkdir -p models/${{ env.PROJECT_NAME }}/masl/${{ env.DOMAIN_NAME }}
docker run -v ${GITHUB_WORKSPACE}/models/${{ env.PROJECT_NAME }}:/root levistarrett/xtuml2masl -xf -i . -d ${{ env.DOMAIN_NAME }} -o masl
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/xtuml/${{ steps.lowercase.outputs.DOMAIN_LOWER }}

- name: Build image (prod)
uses: docker/build-push-action@v3
with:
context: models/${{ env.PROJECT_NAME }}
tags: ${{ steps.meta.outputs.tags }}
target: install-release
build-args: EXTRA_MASL_ARGS=${{ env.EXTRA_MASL_ARGS }}
push: true

- name: Run test
run: |
cd models/${{ env.PROJECT_NAME }}
docker compose -f docker-compose.test.yml build --no-cache
docker compose -f docker-compose.test.yml up --force-recreate
- name: Archive test results
uses: actions/upload-artifact@v3
with:
name: ${{ steps.lowercase.outputs.DOMAIN_LOWER }}-results
path: models/**/test_results/*.json

build_istore:
runs-on: ubuntu-latest
env:
PROJECT_NAME: InvariantStore
DOMAIN_NAME: IStore
EXTRA_MASL_ARGS: '-skiptranslator Sqlite'
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- id: lowercase
run: echo '::set-output name=DOMAIN_LOWER::'$(echo "console.log('${{ env.DOMAIN_NAME }}'.toLowerCase())" | node -)

- name: Check if files have been modified
id: check-modified
uses: tj-actions/changed-files@v29.0.0
with:
files: models/${{ env.PROJECT_NAME }}
cd models/
./gen_all.sh
- name: Generate MASL
- name: Build (test)
run: |
mkdir -p models/${{ env.PROJECT_NAME }}/masl/${{ env.DOMAIN_NAME }}
docker run -v ${GITHUB_WORKSPACE}/models/${{ env.PROJECT_NAME }}:/root levistarrett/xtuml2masl -xf -i . -d ${{ env.DOMAIN_NAME }} -o masl
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
cd models/
./build_all.sh test
- name: Generate docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/xtuml/${{ steps.lowercase.outputs.DOMAIN_LOWER }}

- name: Build image (prod)
uses: docker/build-push-action@v3
with:
context: models/${{ env.PROJECT_NAME }}
tags: ${{ steps.meta.outputs.tags }}
target: install-release
build-args: EXTRA_MASL_ARGS=${{ env.EXTRA_MASL_ARGS }}
push: true

- name: Run test
- name: Run tests
run: |
cd models/${{ env.PROJECT_NAME }}
docker compose -f docker-compose.test.yml build --no-cache
docker compose -f docker-compose.test.yml up --force-recreate
cd models/
./test_all.sh
- name: Archive test results
uses: actions/upload-artifact@v3
with:
name: ${{ steps.lowercase.outputs.DOMAIN_LOWER }}-results
path: models/**/test_results/*.json

build_aeo_svdc:
runs-on: ubuntu-latest
env:
PROJECT_NAME: AEO_SVDC
DEPLOYMENT_NAME: AEO_SVDC
DOCKER_BUILDKIT: '1'
EXTRA_MASL_ARGS: '-skiptranslator Sqlite'
needs:
- build_aeordering
- build_aesequencedc
- build_istore
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- id: lowercase
run: echo '::set-output name=DEPLOYMENT_LOWER::'$(echo "console.log('${{ env.DEPLOYMENT_NAME }}'.toLowerCase())" | node -)

- name: Check if files have been modified
id: check-modified
uses: tj-actions/changed-files@v29.0.0
with:
files: |
models/${{ env.PROJECT_NAME }}
models/AEOrdering
models/SequenceVerificationDataCentric
models/InvariantStore
- name: Generate MASL
- name: Build (prod)
run: |
mkdir -p models/${{ env.PROJECT_NAME }}/masl/${{ env.DEPLOYMENT_NAME }}
docker run -v ${GITHUB_WORKSPACE}/models/${{ env.PROJECT_NAME }}:/root levistarrett/xtuml2masl -xf -i . -p ${{ env.DEPLOYMENT_NAME }} -o masl
cd models/
./build_all.sh test
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/xtuml/${{ steps.lowercase.outputs.DEPLOYMENT_LOWER }}

- name: Build image (prod)
uses: docker/build-push-action@v3
with:
context: models/${{ env.PROJECT_NAME }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
EXTRA_MASL_ARGS=${{ env.EXTRA_MASL_ARGS }}
VERSION_TAG=${{ steps.meta.outputs.version }}
push: true

generate_report:
runs-on: ubuntu-latest
needs:
- build_aeordering
- build_aereception
- build_aesequencedc
- build_istore
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
# Checkout the repository
- uses: actions/checkout@v3
# TODO publish docker image

# Configure python
- uses: actions/setup-python@v3
Expand All @@ -320,10 +57,11 @@ jobs:
cache: 'pip'
- run: pip install -r test_reporting/requirements.txt

# Download test results
- uses: actions/download-artifact@v3
with:
path: test_reporting/results
# Gather test results
- name: Gather results
run: |
mkdir -p test_reporting/results
find models/ -name test_results -exec cp -r {} test_reporting/results/ \;
# Get a shortened SHA
- name: Shorten SHA
Expand Down
4 changes: 3 additions & 1 deletion models/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ bash -c "cd AEOrdering && ../../bin/build.sh $@"
bash -c "cd AEReception && ../../bin/build.sh $@"
bash -c "cd InvariantStore && ../../bin/build.sh $@"
bash -c "cd SequenceVerificationDataCentric && ../../bin/build.sh $@"
bash -c "cd AEO_SVDC && ../../bin/deploy.sh $@"
if [[ $# < 1 || $1 != "test" ]]; then
bash -c "cd AEO_SVDC && ../../bin/deploy.sh $@"
fi
13 changes: 9 additions & 4 deletions models/gen_all.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
XTUML2MASL=xtuml2masl
which $XTUML2MASL &>/dev/null
if [[ $? == 1 ]]; then
XTUML2MASL="docker run -v /${PWD}:/root levistarrett/xtuml2masl"
fi
set -e
xtuml2masl -xf -i AEOrdering -o AEOrdering/masl -d AEOrdering
xtuml2masl -xf -i AEReception -o AEReception/masl -d AEReception
xtuml2masl -xf -i InvariantStore -o InvariantStore/masl -d IStore
xtuml2masl -xf -i SequenceVerificationDataCentric -o SequenceVerificationDataCentric/masl -d AESequenceDC
$XTUML2MASL -xf -i AEOrdering -o AEOrdering/masl -d AEOrdering
$XTUML2MASL -xf -i AEReception -o AEReception/masl -d AEReception
$XTUML2MASL -xf -i InvariantStore -o InvariantStore/masl -d IStore
$XTUML2MASL -xf -i SequenceVerificationDataCentric -o SequenceVerificationDataCentric/masl -d AESequenceDC
6 changes: 6 additions & 0 deletions models/test_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
bash -c "cd AEOrdering && ./test.sh $@"
bash -c "cd AEReception && ./test.sh $@"
bash -c "cd InvariantStore && ./test.sh $@"
bash -c "cd SequenceVerificationDataCentric && ./test.sh $@"

0 comments on commit 66228ca

Please sign in to comment.