#3742 Merge multiple project files into multiple project outputs (MIMO) #7442
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
check_prettier: | |
if: "!contains(github.event.head_commit.message, 'Deploying to main')" | |
name: Code Style | |
runs-on: ubuntu-latest | |
env: | |
working-directory: ./ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Cache root node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-root-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install node | |
run: npm ci | |
working-directory: ${{env.working-directory}} | |
- name: Check formatting and linting | |
run: | | |
npm run format:check | |
working-directory: ${{env.working-directory}} | |
build_visualization_test: | |
if: "!contains(github.event.head_commit.message, 'Deploying to main')" | |
name: Unit Tests (Visualization) | |
runs-on: ubuntu-latest | |
env: | |
working-directory: ./visualization | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install node | |
run: npm ci | |
working-directory: ${{env.working-directory}} | |
- name: Run unit tests | |
env: | |
NODE_OPTIONS: "--max_old_space_size=4096" | |
run: | | |
npm run test:ci | |
working-directory: ${{env.working-directory}} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: ./visualization/dist/ | |
build_visualization_e2e: | |
if: "!contains(github.event.head_commit.message, 'Deploying to main')" | |
name: E2E Tests (Visualization) | |
runs-on: ubuntu-latest | |
env: | |
working-directory: ./visualization | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install node | |
run: npm ci | |
working-directory: ${{env.working-directory}} | |
- name: Build and run e2e tests | |
env: | |
PUPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome" | |
run: | | |
npm run build | |
npm run e2e:ci | |
working-directory: ${{env.working-directory}} | |
test_and_sonar_analysis: | |
name: "Code Quality Results (analysis)" | |
runs-on: ubuntu-latest | |
env: | |
working-directory: ./analysis | |
project-directory: . | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Build | |
run: | | |
chmod +x ./gradlew | |
./gradlew build | |
working-directory: ${{env.working-directory}} | |
- name: Test Analysis | |
run: | | |
./gradlew integrationTest | |
./gradlew jacocoTestReport | |
working-directory: ${{env.working-directory}} | |
- name: Docker Test Analysis | |
run: | | |
user_instance="docker_runner" | |
docker build ./analysis -t local-ccsh --build-arg USER_ADD=true --build-arg USER_ID=1001 --build-arg USERNAME=${user_instance} --no-cache | |
current_version=$(node -pe "require('./analysis/node-wrapper/package.json').version") | |
docker run -w /home/${user_instance}/cc/analysis/test -v $(pwd):/home/${user_instance}/cc local-ccsh bash ./golden_test.sh ${current_version} /home/${user_instance}/tmp-files/ /usr/local/bin/ccsh | |
docker build ./analysis -t local-ccsh --no-cache | |
working-directory: ${{env.project-directory}} | |
- name: Setup Java JDK | |
uses: actions/[email protected] | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: SonarCloud Scan Gradle | |
run: | | |
./gradlew sonar | |
working-directory: ${{env.working-directory}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
JAVA_HOME: ${{ env.JAVA_HOME }} | |
publish_sonar_visualization: | |
needs: [build_visualization_test, build_visualization_e2e] | |
name: "Code Quality Results (visualization)" | |
runs-on: ubuntu-latest | |
env: | |
working-directory: ./visualization | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
path: ./visualization/dist/ | |
- name: SonarCloud Scan | |
uses: SonarSource/[email protected] | |
with: | |
projectBaseDir: ./visualization | |
args: > | |
-Dsonar.javascript.lcov.reportPaths=./dist/coverage/lcov.info | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |