Merge branch 'feature-PRESIDECMS-2965_fix-issues-with-numeric-rest-us… #590
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
name: Auto test, build and publish | |
on: | |
push: | |
pull_request: | |
jobs: | |
runtests: | |
name: Preside Test Suite | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[twgit] Init') && github.ref != 'refs/heads/stable'" | |
env: | |
DB_USER: root | |
DB_PASSWORD: root | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- cfengine: "[email protected]" | |
jdkVersion: "11" | |
experimental: false | |
- cfengine: "lucee@^6.1.1-SNAPSHOT" | |
jdkVersion: "21" | |
experimental: true | |
continue-on-error: ${{ matrix.experimental }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Database and Fixtures | |
run: | | |
sudo systemctl start mysql.service | |
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE presidetestsuite;' | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: ${{ matrix.jdkVersion }} | |
- name: Setup CommandBox CLI | |
uses: Ortus-Solutions/[email protected] | |
- name: Install dependencies | |
run: | | |
box install --force --verbose | |
- name: Setup .env For Runner | |
run: | | |
touch ${GITHUB_WORKSPACE}/tests/.env | |
printf "PRESIDETEST_DB_HOST=127.0.0.1\n" >> .env | |
printf "PRESIDETEST_DB_NAME=presidetestsuite\n" >> .env | |
printf "PRESIDETEST_DB_PORT=3306\n" >> .env | |
printf "PRESIDETEST_DB_USER=${{ env.DB_USER }}\n" >> .env | |
printf "PRESIDETEST_DB_PASSWORD=${{ env.DB_PASSWORD }}\n" >> .env | |
- name: Start ${{ matrix.cfengine }} Server | |
run: | | |
# Startup the Server | |
box server start directory="${GITHUB_WORKSPACE}/tests" serverConfigFile="${GITHUB_WORKSPACE}/tests/server.json" cfengine="${{ matrix.cfengine }}" --noSaveSettings --debug | |
# Test site build up | |
curl http://127.0.0.1:9999 | |
- name: Run tests | |
run: | | |
cd tests/ | |
mkdir -p results | |
exitcode=0 | |
box testbox run --verbose outputFile=results/test-results outputFormats=json,antjunit | |
- name: Upload Test Results Artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: preside-test-results-${{ matrix.cfengine }}-jdk${{ matrix.jdkVersion }} | |
path: | | |
tests/results/* | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: tests/results/*.xml | |
runcypresstests: | |
name: Run Cypress Test suites | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[twgit] Init') && github.ref != 'refs/heads/stable'" | |
env: | |
DB_USER: root | |
DB_PASSWORD: root | |
DB_NAME: endtoenddb | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- cfengine: "[email protected]" | |
jdkVersion: "11" | |
experimental: false | |
- cfengine: "lucee@^6.1.1-SNAPSHOT" | |
jdkVersion: "21" | |
experimental: true | |
continue-on-error: ${{ matrix.experimental }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
uses: pixl8/github-action-box-install@v2 | |
with: | |
verbose: true | |
force: true | |
- name: Build static assets with grunt | |
shell: bash | |
run: | | |
cd ./system/assets && | |
npm install && | |
grunt all && | |
rm -rf node_modules | |
- name: Setup Database and Fixtures | |
run: | | |
sudo systemctl start mysql.service | |
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE ${{ env.DB_NAME }};' | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: ${{ matrix.jdkVersion }} | |
- name: Setup CommandBox CLI | |
uses: Ortus-Solutions/[email protected] | |
- name: Start ${{ matrix.cfengine }} Server | |
run: | | |
cd tests/e2e/apps/fullcmsapp/ | |
cp .cfconfig.gh.json .cfconfig.json | |
box install commandbox-cfconfig | |
box server start serverConfigFile="server.json" cfengine="${{ matrix.cfengine }}" --noSaveSettings | |
http_response=$(curl --max-time 120 -s -o /dev/null -w "%{http_code}" http://127.0.0.1:9998) | |
if [ $http_response != "200" ]; then | |
echo "Website startup exited with error: $http_response" | |
echo "Logs:" | |
echo "============" | |
echo | |
box server log name="fullcmsapp" | |
exit 1 | |
fi | |
- name: Run Cypress Test | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: chrome | |
working-directory: tests/e2e/tests | |
publish: | |
name: Publish to Forgebox | |
needs: | |
- runtests | |
- runcypresstests | |
runs-on: ubuntu-latest | |
if: "success() && github.event_name != 'pull_request' && ( startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/release-' ) )" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
uses: pixl8/github-action-box-install@v2 | |
with: | |
verbose: true | |
force: true | |
- name: Build static assets with grunt | |
shell: bash | |
run: | | |
cd ./system/assets && | |
npm install && | |
grunt all && | |
rm -rf node_modules | |
- name: Generate release version number | |
id: versiongen | |
uses: pixl8/github-action-twgit-release-version-generator@v3 | |
with: | |
build_number_start: 8000 | |
- name: Set release variables | |
shell: bash | |
env: | |
RELEASE_VERSION: ${{ steps.versiongen.outputs.semver_release_string }} | |
IS_SNAPSHOT: ${{ steps.versiongen.outputs.semver_is_snapshot }} | |
run: | | |
ZIP_FILE_NAME=Preside-${RELEASE_VERSION/+/-}.zip | |
if [[ "${IS_SNAPSHOT}" == "false" ]] ; then | |
RELEASE_CATEGORY=stable | |
else | |
RELEASE_CATEGORY="bleeding-edge" | |
RELEASE_VERSION="${{ steps.versiongen.outputs.semver_release_number }}-snapshot" | |
fi | |
echo "RELEASE_CATEGORY=$RELEASE_CATEGORY" >> $GITHUB_ENV | |
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV | |
echo "DOWNLOAD_LOCATION=https://downloads.preside.org/$RELEASE_CATEGORY/$ZIP_FILE_NAME" >> $GITHUB_ENV | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Prepare files for release | |
shell: bash | |
run: | | |
DATE_BUILT=$(date -u +"%Y-%m-%d %H:%M:%S UTC") | |
echo "{ \"version\":\"$RELEASE_VERSION\", \"buildDate\":\"$DATE_BUILT\" }" > version.json && | |
echo "Built on: $DATE_BUILT" > "Preside-$RELEASE_VERSION-$RELEASE_CATEGORY.txt" && | |
mv box.json.published box.json | |
- name: Inject version numbers | |
uses: dominicwatson/github-action-envsubst@v1 | |
with: | |
files: box.json version.json system/config/Config.cfc | |
- name: Zip up | |
shell: bash | |
run: zip -rq $ZIP_FILE_NAME * --exclude jmimemagic.log --exclude=".*" --exclude="*.sh" --exclude="zanata.xml" --exclude="\tests/*" --exclude="\system/externals/lucee-spreadsheet/javaloader/*" | |
- name: Push to S3 | |
run: aws s3 cp --acl=public-read $ZIP_FILE_NAME s3://downloads.preside.org/${RELEASE_CATEGORY}/${ZIP_FILE_NAME} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-west-2' | |
- name: Publish to forgebox | |
uses: pixl8/github-action-box-publish@v5 | |
with: | |
forgebox_user: pixl8 | |
forgebox_pass: ${{ secrets.FORGEBOX_PASS }} | |
ignore_timeouts: "true" |