Added tests for bug #526. #329
Workflow file for this run
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 workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Java CI with Maven | |
on: [push, pull_request] | |
jobs: | |
matrix_prep: | |
# Using a separate job and agent so as to be able to use tools like 'sed' and 'jq' | |
runs-on: ubuntu-22.04 | |
# Defining outputs of a job allows for easier consumption and use | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
# Checking out code as the set-matrix step utilizes a file named matrix_includes.json | |
- name: Check out code | |
uses: actions/[email protected] | |
# This step is explained more in a following section | |
- id: set-matrix | |
run: | | |
matrix=$(jq . .github/workflows/matrix_includes.json) | |
echo "matrix={\"include\":$(echo $matrix)}\"" >> $GITHUB_OUTPUT | |
build: | |
needs: matrix_prep | |
runs-on: ubuntu-22.04 | |
strategy: | |
# We need to convert the json string output into an object that the GitHub Workflow expects. | |
# Thankfully, the json-schema for Workflows allows 'matrix' to be set to an expression. | |
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}} | |
steps: | |
- name: Environment | |
run: | | |
echo GITHUB_WORKSPACE $GITHUB_WORKSPACE | |
echo GITHUB_REF $GITHUB_REF | |
echo GITHUB_SHA $GITHUB_SHA | |
echo GITHUB_EVENT_NAME $GITHUB_EVENT_NAME | |
echo JAVA ${{ matrix.java }} | |
echo PROFILE ${{ matrix.profile }} | |
echo TYCHO ${{ matrix.tycho }} | |
- name: Check if update site is needed | |
id: updatesite_check | |
env: | |
PROFILE: ${{ matrix.profile }} | |
run: | | |
if [[ "$PROFILE" == *"updatesites"* ]]; then export UPDATE_SITES=true; fi | |
echo "UPDATE_SITES=${UPDATE_SITES}" | |
echo "UPDATE_SITES=${UPDATE_SITES}" >> $GITHUB_OUTPUT | |
- name: Check out code | |
uses: actions/[email protected] | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/[email protected] | |
with: | |
distribution: 'adopt' | |
java-version: ${{ matrix.java }} | |
- uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/*.product') }} | |
restore-keys: | | |
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/*.product') }} | |
- name: Create directory for website (documentation) | |
run: | | |
mkdir plugins/org.obeonetwork.m2doc.doc/doc | |
- name: Build website (documentation) | |
if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }} | |
run: | | |
export TAG="nightly" | |
if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi | |
echo TAG $TAG | |
chmod a+x ./scripts/website-build.sh | |
./scripts/website-build.sh $TAG | |
- name: Install metacity and xvfb | |
uses: awalsh128/[email protected] | |
with: | |
packages: xvfb metacity | |
version: cache-apt-pkgs-${{ matrix.profile }} | |
- name: Build with Maven (${{ matrix.profile }}) | |
env: | |
MAVEN_OPTS: ${{ matrix.mavenOpt }} | |
run: | | |
/usr/bin/Xvfb :99 -ac -screen 0 1440x900x16& | |
ps auxwww | grep Xvfb | |
export DISPLAY=:99 | |
echo DISPLAY $DISPLAY | |
mvn clean verify -fae -P${{ matrix.profile }} "-Dtycho=${{ matrix.tycho }}" -Dmaven.wagon.provider.http=httpclient -Dmaven.artifact.threads=12 -Dhttp.tcp.nodelay=false | |
- name: Prepare deploy local directory | |
id: prepare_deploy | |
if: ${{ steps.updatesite_check.outputs.UPDATE_SITES && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }} | |
run: | | |
export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)/nightly" | |
if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi | |
chmod a+x ./scripts/prepare-deploy-local-dir.sh | |
./scripts/prepare-deploy-local-dir.sh $GITHUB_WORKSPACE/$TAG_OR_BRANCH | |
echo "TAG_OR_BRANCH=${TAG_OR_BRANCH}" | |
echo "TAG_OR_BRANCH=${TAG_OR_BRANCH}" >> $GITHUB_OUTPUT | |
- name: Deploy to S3 | |
if: ${{ steps.updatesite_check.outputs.UPDATE_SITES && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }} | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --delete | |
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 }} | |
AWS_REGION: "eu-west-1" | |
SOURCE_DIR: ${{ steps.prepare_deploy.outputs.TAG_OR_BRANCH }} | |
DEST_DIR: ${{ steps.prepare_deploy.outputs.TAG_OR_BRANCH }} | |