ci(ci): Rename NuvlaBox to NuvlaEdge #2081
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: Build | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- '*' | |
- '!release-please-*' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting for sonar | |
fetch-depth: 0 | |
- name: Cache local M2 repository | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-lein-${{ hashFiles('**/project.clj') }} | |
restore-keys: | | |
${{ runner.os }}-lein- | |
- name: Cache local M2 repository | |
- name: Cache local NPM repository | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install zopfli | |
run: sudo apt-get install -y zopfli | |
- name: Verify signature NuvlaEdge script | |
run: ./.github/verify_signature.sh | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Setup Sonar Scanner | |
uses: warchant/setup-sonar-scanner@v7 | |
with: | |
version: 4.6.2.2472 | |
- name: Run Sonar Scanner | |
env: | |
# provide GITHUB_TOKEN to get access to secrets.SONARQUBE_TOKEN | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: code | |
run: sonar-scanner | |
-Dsonar.login=${{ secrets.SONARQUBE_TOKEN }} | |
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} | |
- name: SonarQube Quality Gate check | |
uses: sonarsource/[email protected] | |
# Force to fail step after specific time | |
timeout-minutes: 5 | |
with: | |
scanMetadataReportFile: code/.scannerwork/report-task.txt | |
env: | |
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
- name: Extract branch name and substitute slashes | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | tr '/' '-' >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Build time | |
run: echo "BUILD_TIME=$(date --utc +%FT%T.%3NZ)" >> $GITHUB_ENV | |
- name: Install npm deps | |
working-directory: code | |
run: npm ci --legacy-peer-deps | |
- name: Build with lein | |
working-directory: code | |
run: lein install | |
- name: Copy relevant files and pre-compress them | |
run: | | |
mkdir -p container/target/dependency/ui/public | |
cp -r code/resources/public/ container/target/dependency/ui/ | |
rm container/target/dependency/ui/public/ui/js/manifest.edn container/target/dependency/ui/public/ui/index.html.template | |
find container/target/dependency/ui/public/ui -type f -not -name version -a -not -name config.json -a -not -name nuvla-logo.png -exec zopfli {} \; | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.SIXSQ_DOCKER_USERNAME }} | |
password: ${{ secrets.SIXSQ_DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./container | |
file: container/Dockerfile | |
build-args: | | |
GIT_BRANCH=${{ github.head_ref || github.ref_name }} | |
GIT_BUILD_TIME=${{ env.BUILD_TIME }} | |
GIT_COMMIT_ID=${{ github.sha }} | |
PACKAGE_TAG=${{ needs.trigger-release.outputs.tag_name }} | |
GITHUB_RUN_NUMBER=${{ github.run_number }} | |
GITHUB_RUN_ID=${{ github.run_id }} | |
PROJECT_URL=${{ github.server_url }}/${{ github.repository }} | |
push: true | |
tags: > | |
nuvladev/ui:${{ steps.extract_branch.outputs.branch }} | |
notify: | |
if: always() | |
name: Post Workflow Status To Slack | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: Gamesight/slack-workflow-status@master | |
with: | |
repo_token: ${{secrets.GITHUB_TOKEN}} | |
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} |