-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): setup nx agents and improve other CI workflows
- Loading branch information
Showing
13 changed files
with
234 additions
and
150 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: 'Setup Build Tools and Dependencies' | ||
description: Setup node, pnpm, java, flutter, cache, and install dependencies | ||
|
||
inputs: | ||
node-version: # id of input | ||
description: 'Node version' | ||
required: false | ||
default: 20 | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Derive appropriate SHAs for base and head for `nx affected` commands | ||
uses: nrwl/nx-set-shas@v4 | ||
|
||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8.2 | ||
|
||
- name: Setup Node.js ${{ inputs.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
cache: 'pnpm' | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
- run: java -version | ||
shell: bash | ||
|
||
- name: Setup Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: 'stable' | ||
cache: true | ||
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache | ||
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path | ||
architecture: x64 # optional, x64 or arm64 | ||
- run: flutter --version | ||
shell: bash | ||
|
||
- name: Cache node_modules | ||
id: cache-modules | ||
uses: actions/cache@v4 | ||
with: | ||
lookup-only: true | ||
path: '**/node_modules' | ||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }} | ||
|
||
- name: Install packages | ||
run: pnpm install --frozen-lockfile | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
|
||
# Needed for nx-set-shas when run on the main branch | ||
permissions: | ||
actions: read | ||
contents: read | ||
|
||
jobs: | ||
develop: | ||
runs-on: ubuntu-latest | ||
env: | ||
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install node, pnpm, and dependencies | ||
uses: ./.github/actions/install-dependencies | ||
|
||
# Connect your workspace on nx.app and uncomment this to enable task distribution. | ||
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e" targets have been requested | ||
- run: pnpm exec nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" --stop-agents-after="e2e" | ||
|
||
# This line is needed for nx affected to work when CI is running on a PR | ||
- run: git branch --track develop origin/develop | ||
|
||
- run: pnpm exec nx-cloud record -- nx format:check | ||
- run: pnpm exec nx affected -t lint test build e2e --exclude=smoke --codeCoverage |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Nightly Smoke Tests | ||
|
||
on: | ||
# Trigger manually or on schedule | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
run_smoke_tests: | ||
name: Smoke Tests | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
timeout-minutes: 60 | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
node-version: [20] | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup node, pnpm, java, flutter, and dependencies | ||
uses: ./.github/actions/setup | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Run smoke tests | ||
env: | ||
NX_E2E_CI_CACHE_KEY: smoke-gha-${{ matrix.os }}-${{ matrix.node-version }} | ||
NX_RUN_GROUP: ${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }} | ||
run: pnpm nx test smoke --verbose |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
pnpm affected:format | ||
pnpm affected:lint | ||
pnpm affected:test | ||
pnpm sync-preset-schemas |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
launch-templates: | ||
linux-medium-js-java-flutter: | ||
resource-class: 'docker_linux_amd64/medium' | ||
image: 'ubuntu22.04-node20.9-v2' | ||
init-steps: | ||
- name: Checkout | ||
uses: 'nrwl/nx-cloud-workflows/v3.5/workflow-steps/checkout/main.yaml' | ||
- name: Restore Node Modules Cache | ||
uses: 'nrwl/nx-cloud-workflows/v3.5/workflow-steps/cache/main.yaml' | ||
env: | ||
KEY: 'package-lock.json|yarn.lock|pnpm-lock.yaml' | ||
PATHS: 'node_modules' | ||
BASE_BRANCH: 'main' | ||
- name: Restore Maven/Gradle Cache | ||
uses: 'nrwl/nx-cloud-workflows/v3.5/workflow-steps/cache/main.yaml' | ||
env: | ||
KEY: 'pom.xml|build.gradle|build.gradle.kts|settings.gradle|settings.gradle.kts' | ||
PATHS: '~/.m2/repository' | ||
BASE_BRANCH: 'main' | ||
|
||
- name: Install Node Modules | ||
uses: 'nrwl/nx-cloud-workflows/v3.5/workflow-steps/install-node-modules/main.yaml' | ||
|
||
- name: Install required System tools | ||
script: | | ||
sudo apt-get update | ||
sudo apt-get -yqq install zip unzip | ||
- name: Install Flutter | ||
script: | | ||
flutterVersion="${FLUTTER_VERSION:-3.19.3}" | ||
flutterChannel="${FLUTTER_CHANNEL:-stable}" | ||
flutterPkgName="flutter_linux_${flutterVersion}-${flutterChannel}.tar.xz" | ||
flutterPkgUrl="https://storage.googleapis.com/flutter_infra_release/releases/${flutterChannel}/linux/${flutterPkgName}" | ||
if [ ! -d $HOME/flutter ] | ||
then | ||
echo "⬇️ Downloading and Installing Flutter from $flutterPkgName..." | ||
curl -s -L ${flutterPkgUrl} | tar -xJf - -C $HOME | ||
echo 'export PATH="$PATH:$HOME/flutter/bin"' >> $HOME/.bashrc | ||
echo 'export PATH="$PATH:$HOME/flutter/bin"' >> $HOME/.zshrc | ||
source $HOME/.bashrc | ||
source $HOME/.zshrc | ||
else | ||
echo "⏭️ Flutter v$flutterPkgName already installed. Skipping it" | ||
fi | ||
echo "⌛️ Checking Flutter Installation and Version..." | ||
flutter --version | ||
echo "✅ Done !" | ||
- name: Install SDKMan! and Java | ||
script: | | ||
if [ ! -d $HOME/.sdkman ] | ||
then | ||
echo "⬇️ Downloading and Installing SDKMan!..." | ||
curl -s "https://get.sdkman.io" | bash | ||
source $HOME/.sdkman/bin/sdkman-init.sh | ||
else | ||
echo "⏭️ SDKMan! already installed. Skipping it" | ||
fi | ||
sdk version | ||
jdkVersion="${JDK_VERSION:-17.0.10}" | ||
jdkDistro="${JDK_DISTRO:-ms}" | ||
javaVersion="${jdkVersion}-${jdkDistro}" | ||
if [ ! -d $HOME/.sdkman/candidates/gradle/$javaVersion ] | ||
then | ||
echo "⌛️ Installing Java v$javaVersion.." | ||
sdk install java $javaVersion | ||
sdk use java $javaVersion | ||
else | ||
echo "⏭️ Java v$javaVersion already installed. Skipping it" | ||
fi | ||
echo "⌛️ Checking Java Installation and Version..." | ||
java -version | ||
echo "✅ Done !" | ||
- name: Export PATH to Nx Cloud Environment | ||
script: | | ||
ls -l $HOME/flutter/bin | ||
echo "path: $PATH" | ||
echo "PATH=$PATH:$HOME/flutter/bin" >> $NX_CLOUD_ENV | ||
echo "PATH=$PATH:$HOME/.sdkman/candidates/java/$javaVersion/bin" >> $NX_CLOUD_ENV | ||
echo "path after: $PATH" | ||
echo "cloudEnv: $NX_CLOUD_ENV" | ||
ls -l $NX_CLOUD_ENV | ||
flutter --version | ||
Oops, something went wrong.