From a175059dfdefc3e47095ab13b801bd1b38da53f9 Mon Sep 17 00:00:00 2001 From: Hugo van Rijswijk Date: Sat, 14 Sep 2024 15:21:34 +0200 Subject: [PATCH] chore: remove nx cloud (#3415) --- .github/setup/action.yml | 36 ++++++++++++++++++++++++ .github/workflows/ci.yml | 24 ++-------------- .github/workflows/mutation-testing.yml | 23 +++------------ .github/workflows/release.yml | 11 ++------ .github/workflows/update-screenshots.yml | 8 +----- nx.json | 1 - 6 files changed, 47 insertions(+), 56 deletions(-) create mode 100644 .github/setup/action.yml diff --git a/.github/setup/action.yml b/.github/setup/action.yml new file mode 100644 index 000000000..cb11f5736 --- /dev/null +++ b/.github/setup/action.yml @@ -0,0 +1,36 @@ +name: 'Setup CI' +description: 'Set up npm, Java, and cache for CI' +inputs: + node-version: + description: 'The Node.js version to use' + default: '20.x' + required: false + setup-java: + description: 'Whether to set up Java' + default: 'false' + required: false +runs: + using: 'composite' + steps: + - uses: nrwl/nx-set-shas@v4 + with: + main-branch-name: master + - name: Use Node.js ${{ inputs.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + cache: 'npm' + - uses: actions/setup-java@v4 + if: ${{ inputs.setup-java == 'true' }} + with: + distribution: 'temurin' + java-version: 21 + cache: 'sbt' + - uses: actions/cache@v4 + with: + path: .nx + key: ${{ runner.os }}-nx-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-nx- + - run: npm ci + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b0e80c5c..05b27e7e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,9 +6,6 @@ on: pull_request: types: [synchronize, opened, reopened] -env: - NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - jobs: build_and_test: runs-on: ${{ matrix.os }} @@ -22,20 +19,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: nrwl/nx-set-shas@v4 - with: - main-branch-name: master - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - uses: ./.github/setup with: node-version: ${{ matrix.node-version }} - cache: 'npm' - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - cache: 'sbt' - - run: npm ci + setup-java: true # Only install playwright if elements project is affected - name: affected id: affected @@ -60,12 +47,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: 'npm' - - run: npm ci + - uses: ./.github/setup - name: Install Playwright Browsers run: npx playwright install chromium --with-deps - run: npm run download-incremental-reports diff --git a/.github/workflows/mutation-testing.yml b/.github/workflows/mutation-testing.yml index e66b884b3..2a8b26037 100644 --- a/.github/workflows/mutation-testing.yml +++ b/.github/workflows/mutation-testing.yml @@ -11,11 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: 'npm' - - run: npm ci + - uses: ./.github/setup - run: npx nx run metrics:stryker env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} @@ -26,11 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: 'npm' - - run: npm ci + - uses: ./.github/setup - name: Install Playwright Browsers run: npx playwright install chromium --with-deps - name: Run Stryker @@ -42,16 +34,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20.x - cache: 'npm' - - uses: actions/setup-java@v4 + - uses: ./.github/setup with: - distribution: 'temurin' - java-version: 21 - cache: 'sbt' - - run: npm ci + setup-java: true - name: Run Stryker run: npx nx run metrics-scala:stryker env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aefc331da..430a67c65 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,20 +12,15 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: 21 - cache: 'sbt' - - uses: actions/setup-node@v4 + fetch-depth: 0 + - uses: ./.github/setup with: - node-version: 20.x - cache: 'npm' + setup-java: true - name: Set Release Env run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc echo ${{ secrets.PGP_SECRET }} | base64 --decode | gpg --batch --import - - run: npm ci - run: npx nx run-many --target=build - name: Release run: npm run lerna:publish diff --git a/.github/workflows/update-screenshots.yml b/.github/workflows/update-screenshots.yml index 44873d529..954318971 100644 --- a/.github/workflows/update-screenshots.yml +++ b/.github/workflows/update-screenshots.yml @@ -7,7 +7,6 @@ jobs: strategy: fail-fast: false matrix: - node-version: [20.x] os: [ubuntu-latest, windows-latest] steps: - name: Generate token @@ -19,12 +18,7 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ steps.generate-token.outputs.token }} - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci + - uses: ./.github/setup - run: npx playwright install chromium firefox --with-deps - run: npx nx run-many --target=build - run: npx nx run elements:test:integration:update diff --git a/nx.json b/nx.json index aa321f89f..fd8421711 100644 --- a/nx.json +++ b/nx.json @@ -1,7 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/nrwl/nx/master/packages/nx/schemas/nx-schema.json", "extends": "nx/presets/npm.json", - "nxCloudAccessToken": "ZWQ4NmEyMmYtYTcwZS00MmJlLTlmYzUtYTRjNWI1MmZiMDg1fHJlYWQ=", "namedInputs": { "default": ["{projectRoot}/**/*", "{workspaceRoot}/package-lock.json", { "runtime": "node -v" }], "production": ["!{projectRoot}/test/**/*", "!{projectRoot}/.eslintrc", "!{projectRoot}/stryker.conf.js"]