[843] Implement export of AllocationDefinition and basic export of Al… #55
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: Continuous integration | |
on: | |
push: | |
paths-ignore: | |
- "CHANGELOG.adoc" | |
- "docker-compose.yml" | |
- ".github/PULL_REQUEST_TEMPLATE.md" | |
- "doc/**" | |
branches: | |
- "**" | |
tags: | |
- "*" | |
pull_request: | |
paths-ignore: | |
- "CHANGELOG.adoc" | |
- "docker-compose.yml" | |
- ".github/PULL_REQUEST_TEMPLATE.md" | |
- "doc/**" | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
attestations: write | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
if: github.event_name != 'pull_request' | |
with: | |
fetch-depth: 0 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node SDK | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.7 | |
registry-url: https://npm.pkg.github.com/ | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
- name: Setup Java SDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: "temurin" | |
- name: Setup some global environment variables | |
run: | | |
echo "git_describe=$(git describe --always)" >> $GITHUB_ENV | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build the frontend packages | |
run: | | |
echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" >> .npmrc | |
echo "CI=true" >> $GITHUB_ENV | |
npm ci | |
npm run build | |
- name: Copy frontend artifacts | |
run: | | |
mkdir -p backend/application/syson-frontend/src/main/resources/static | |
cp -R frontend/syson/dist/* backend/application/syson-frontend/src/main/resources/static | |
- name: Build the backend | |
env: | |
USERNAME: ${{github.actor}} | |
PASSWORD: ${{secrets.GITHUB_TOKEN}} | |
run: mvn -U -B -e clean verify --settings settings.xml | |
- name: Archive the code coverage results | |
run: tar -cf coverage.tar backend/releng/syson-test-coverage/target/site/jacoco-aggregate | |
- name: Store code coverage results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: jacoco | |
path: coverage.tar | |
retention-days: 5 | |
- name: Check the global code coverage | |
run: jshell scripts/check-coverage.jsh | |
- name: Publish the backend | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
USERNAME: ${{github.actor}} | |
PASSWORD: ${{secrets.GITHUB_TOKEN}} | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: mvn -B deploy -DskipTests --settings settings.xml | |
- name: Publish the frontend packages | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
npm publish --workspaces | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: eclipsesyson/syson | |
- name: Set up Docker Buildx to use cache feature | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
id: load | |
uses: docker/build-push-action@v6 | |
with: | |
context: backend/application/syson-application | |
load: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Check the integration test code | |
run: | | |
npm ci | |
npm run eslint | |
working-directory: integration-tests | |
- name: Run end to end tests against the application | |
if: startsWith(github.ref, 'refs/tags/v') == false && github.ref != 'refs/heads/master' | |
uses: cypress-io/github-action@v6 | |
with: | |
build: docker compose -f docker-compose-integration-tests.yml up -d | |
start: docker compose -f docker-compose-integration-tests.yml ps | |
wait-on: "http://localhost:8080/login" | |
wait-on-timeout: 180 | |
working-directory: integration-tests | |
record: false | |
env: | |
IMAGE_TAG: eclipsesyson/syson:${{ steps.meta.outputs.version }} | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Store Cypress screenshots | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cypress-screenshots | |
path: integration-tests/target/screenshots/**/*.png | |
retention-days: 5 | |
- name: Log in to Docker Hub | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.ORG_DOCKER_HUB_USER }} | |
password: ${{ secrets.ORG_DOCKER_HUB_TOKEN }} | |
- name: Push Docker image | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: backend/application/syson-application | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Configure AWS CLI for SysON | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-3 | |
- name: Upload the Docker configuration for AWS Elastic Beanstalk | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
env: | |
IMAGE_TAG: eclipsesyson/syson:${{ steps.meta.outputs.version }} | |
run: | | |
sed -e "s|IMAGE_NAME|$IMAGE_TAG|" Dockerrun.aws.json.template > Dockerrun.aws.json | |
aws s3 cp Dockerrun.aws.json s3://syson-deployment/integration/${{ env.git_describe }}/Dockerrun.aws.json | |
- name: Create a new ElasticBeanstalk Application Version for SysON Staging | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: aws elasticbeanstalk create-application-version --application-name "SysON" --source-bundle S3Bucket="syson-deployment",S3Key="integration/${{ env.git_describe }}/Dockerrun.aws.json" --version-label "${{ env.git_describe }}" --description "${{ github.sha }}" | |
- name: Deploy a new ElasticBeanstalk Application Version for SysON Staging | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: aws elasticbeanstalk update-environment --environment-name "syson-staging" --version-label "${{ env.git_describe }}" |