-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
113 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,113 @@ | ||
name: run-cta-wave-test-vectors | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'development' | ||
- 'parallelize' | ||
|
||
env: | ||
TESTS_URL: https://cta-wave.github.io/Test-Content/database.json | ||
TESTS_FILENAME: database.json | ||
RESULT_DIR: /var/www/html/jccp-dashboard/production-data/cta/ | ||
|
||
jobs: | ||
go-get-matrix: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate matrix | ||
id: set-matrix | ||
run: | | ||
curl -v -sko ${{ env.TESTS_FILENAME }} ${{ env.TESTS_URL }} | ||
echo "::set-output name=matrix::$(cat ${{ env.TESTS_FILENAME }} | jq -r -c keys)" | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
run-test-vectors: | ||
runs-on: ubuntu-latest | ||
needs: go-get-matrix | ||
continue-on-error: true | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
submenu: ${{ fromJson(needs.go-get-matrix.outputs.matrix) }} | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: curl, xdebug, xml | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '8' | ||
- name: Checkout out repository | ||
uses: actions/checkout@v3 | ||
- name: Run CLI | ||
run: | | ||
mkdir Conformance-Frontend/temp | ||
cd Utils | ||
mkdir results | ||
curl -sko ${{ env.TESTS_FILENAME }} ${{ env.TESTS_URL }} | ||
export vectors=$(cat ${{ env.TESTS_FILENAME }} |jq -j '."${{ matrix.submenu }}" | .[].mpdPath as $url | $url, " "') | ||
for url in $(echo $vectors) | ||
do | ||
outfile=results/${url//[\/:]/_} | ||
php Process_cli.php -i $url > $outfile | ||
if [ $(stat --format %s $outfile) -eq 31 ] | ||
then | ||
rm $outfile | ||
fi | ||
done | ||
id: run_cli | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: cli-results | ||
path: Utils/results/ | ||
get-result: | ||
runs-on: ubuntu-latest | ||
needs: run-test-vectors | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: cli-results | ||
- name: create joined result | ||
id: mangle | ||
run: | | ||
export JCCP_RUN_ID=$(uuidgen) | ||
export JCCP_RUN_TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S") | ||
export JCCP_RUN_FILENAME=$(date +"%Y%m%d%H%M%S%3N").json | ||
cat > "$JCCP_RUN_FILENAME" << EOF | ||
{ | ||
"id": "$JCCP_RUN_ID", | ||
"timestamp": "$JCCP_RUN_TIMESTAMP", | ||
"source": "CTA WAVE", | ||
"type": "cta", | ||
"results": [ | ||
EOF | ||
ls -1 http*|head -n1|xargs cat >> "$JCCP_RUN_FILENAME" | ||
for i in $(ls -1 http*|tail -n+2) | ||
do | ||
echo , >> "$JCCP_RUN_FILENAME" | ||
cat $i >> "$JCCP_RUN_FILENAME" | ||
done | ||
echo "]}" >> "$JCCP_RUN_FILENAME" | ||
cat "$JCCP_RUN_FILENAME" | ||
echo "::set-output name=result-file::$JCCP_RUN_FILENAME" | ||
- name: scp results to dashboard | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USER }} | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
source: ${{ steps.mangle.outputs.result-file }} | ||
target: ${{ env.RESULT_DIR }} | ||
- name: add results to index | ||
uses: fifsky/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
user: ${{ secrets.USER }} | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
command: | | ||
cd ${{ env.RESULT_DIR }} | ||
echo ${{ steps.mangle.outputs.result-file }} >> index |