| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| --- |
| name: CI |
| on: |
| push: |
| branches-ignore: |
| - "dependabot/**" # dependabot branches |
| - "update/**" # scala-steward branches |
| pull_request: |
| types: [opened, synchronize, reopened] |
| |
| permissions: |
| contents: read |
| pull-requests: read |
| |
| # Cancel CI runs in progress when a pull request is updated. |
| concurrency: |
| group: ci-${{ github.head_ref || ((github.ref_name != 'main' && github.ref_name) || github.run_id) }}-${{ github.workflow }} |
| cancel-in-progress: true |
| |
| jobs: |
| single-commit: |
| name: Single Commit Pull Request |
| if: github.event_name == 'pull_request' |
| runs-on: ubuntu-22.04 |
| steps: |
| - name: Check Single Commit |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| with: |
| script: | |
| const commits = await github.rest.pulls.listCommits({ |
| ...context.repo, |
| pull_number: context.issue.number, |
| }); |
| core.info("Number of commits in this pull request: " + commits.data.length); |
| if (commits.data.length > 1) { |
| core.setFailed("If approved with two +1's, squash this pull request into one commit"); |
| } |
| |
| code-format: |
| name: TypeScript/Scala/Svelte Formatting |
| strategy: |
| max-parallel: 1 |
| matrix: |
| java_distribution: [temurin] |
| java_version: [17] |
| os: [ubuntu-22.04] |
| node: ["20"] |
| runs-on: ${{ matrix.os }} |
| defaults: |
| run: |
| shell: bash |
| env: |
| SBT: sbt -J-Xms1024m -J-Xmx5120m -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=1024m ++2.13.16 |
| steps: |
| ############################################################ |
| # Setup |
| ############################################################ |
| - name: Check out repository |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| |
| - name: Setup Java |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 |
| with: |
| distribution: ${{ matrix.java_distribution }} |
| java-version: ${{ matrix.java_version }} |
| |
| - name: Install Node.js |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| with: |
| node-version: ${{ matrix.node }} |
| cache: yarn |
| cache-dependency-path: yarn.lock |
| |
| - name: Setup sbt |
| uses: sbt/setup-sbt@508b753e53cb6095967669e0911487d2b9bc9f41 # v1 |
| |
| ############################################################ |
| # Lint/format checks |
| ############################################################ |
| |
| - name: Scala format check |
| run: $SBT scalafmtCheck |
| |
| - name: Scala sbt format check |
| run: $SBT scalafmtSbtCheck |
| |
| - name: Install node dependencies |
| run: yarn install --frozen-lockfile |
| |
| - name: TypeScript lint |
| run: yarn lint |
| |
| build-test-package: |
| name: "Build, Test, and Package (OS: ${{ matrix.os }}, Node: ${{ matrix.node }}, Java: ${{ matrix.java_version }}, VS Code: ${{ matrix.vscode }})" |
| strategy: |
| max-parallel: 15 |
| matrix: |
| java_distribution: [temurin] |
| java_version: [8, 11, 17, 21] |
| os: [macos-15, ubuntu-22.04, windows-2022] |
| node: ["20.19.4", "22.14.0"] |
| vscode: ["1.90.0", "stable"] # v1.90.0 is the first version of VSCode to use Node 20 |
| exclude: |
| # java 8 not available on macos-15 |
| - os: macos-15 |
| java_version: 8 |
| ## Reduce number of macos runs by only testing latest node, java and vscode versions on macos. |
| ## NOTE: Usually if something works on ubuntu it works on macos. |
| - os: macos-15 |
| java_version: 11 |
| - os: macos-15 |
| java_version: 17 |
| - os: macos-15 |
| node: "20.19.4" |
| - os: macos-15 |
| vscode: "1.90.0" |
| fail-fast: false # don't immediately fail all other jobs if a single job fails |
| runs-on: ${{ matrix.os }} |
| defaults: |
| run: |
| shell: bash |
| env: |
| DAFFODIL_TEST_VSCODE_VERSION: ${{ matrix.vscode }} |
| steps: |
| ############################################################ |
| # Setup |
| ############################################################ |
| - name: Check out repository |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| |
| - name: Setup Java |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 |
| with: |
| distribution: ${{ matrix.java_distribution }} |
| java-version: ${{ matrix.java_version }} |
| |
| # some runner oses don't have sbt by default |
| - name: Setup sbt |
| uses: sbt/setup-sbt@508b753e53cb6095967669e0911487d2b9bc9f41 # v1 |
| |
| - name: Install Node.js |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| with: |
| node-version: ${{ matrix.node }} |
| cache: yarn |
| cache-dependency-path: yarn.lock |
| |
| ############################################################ |
| # Build & Package |
| ############################################################ |
| |
| - name: Install node dependencies |
| run: yarn install --frozen-lockfile |
| |
| - name: Runs tests - Linux |
| run: xvfb-run -a yarn test |
| if: runner.os == 'Linux' |
| |
| - name: Runs tests - Windows/Mac |
| run: yarn test |
| if: runner.os != 'Linux' |
| |
| - name: Check for Errors in macOS |
| run: tail -n 1000 '/Users/runner/Library/Application Support/omega_edit/'* && exit 1 |
| if: failure() && runner.os == 'macOS' |
| |
| - name: Package |
| run: yarn package |