-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge feat/ceramic-tests into feat/mm-private-keys (#44)
* docs: remove mentions of rinkeby (#34) * docs: remove rinkeby mentions Co-authored-by: martines3000 <domajnko.martin@gmail.com> * fix: fixes deploy workflow (#37) * fix: should fix deploy_docs workflow * fix: depend on built packages when starting snap package (#38) * fix: release please for monorepo (#39) * fix: should fix release-please workflow * chore: try to fix release * chore: add dispatch to release * chore: change last release sha * chore: update bootstrap-sha * fix: fix some old issues and add jest-eslint plugin * fix: ignore coverage in prettier * chore: upgrade veramo + metamask * docs: update discord link * feat: integrates nx-cloud and updates workflows (#42) * feat: adds nx-cloud and updates workflows * fix: change default branch and set node-version * fix: volta pin versions * chore: test forked workflow * chore: try removing @main * chore: try using local workflow * fix: fixes typo and secrets * chore: update yarn.lock * chore: lint * fix: deploy_docs.yml Co-authored-by: martines3000 <domajnko.martin@gmail.com> Co-authored-by: Martin Domajnko <35891136+martines3000@users.noreply.github.com> Co-authored-by: Urban <urbanfoundit@gmail.com>
- Loading branch information
1 parent
ec508b8
commit 96651ef
Showing
17 changed files
with
734 additions
and
96 deletions.
There are no files selected for viewing
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,34 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
main: | ||
name: Nx Cloud - Main Job | ||
uses: ./.github/workflows/nx-cloud-main.yml | ||
secrets: inherit | ||
with: | ||
node-version: 16.15.1 | ||
number-of-agents: 3 | ||
main-branch-name: 'develop' | ||
init-commands: | | ||
yarn exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3 | ||
parallel-commands-on-agents: | | ||
yarn exec nx affected --target=lint --parallel=3 | ||
yarn exec nx affected --target=test:ci --parallel=3 | ||
yarn exec nx affected --target=build --parallel=3 | ||
agents: | ||
name: Nx Cloud - Agents | ||
uses: ./.github/workflows/nx-cloud-agents.yml | ||
secrets: inherit | ||
with: | ||
number-of-agents: 3 | ||
node-version: 16.15.1 |
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,206 @@ | ||
name: Nx Cloud Agents | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
NX_CLOUD_ACCESS_TOKEN: | ||
required: false | ||
NX_CLOUD_AUTH_TOKEN: | ||
required: false | ||
inputs: | ||
number-of-agents: | ||
required: true | ||
type: number | ||
environment-variables: | ||
required: false | ||
type: string | ||
node-version: | ||
required: false | ||
type: string | ||
yarn-version: | ||
required: false | ||
type: string | ||
npm-version: | ||
required: false | ||
type: string | ||
pnpm-version: | ||
required: false | ||
type: string | ||
install-commands: | ||
required: false | ||
type: string | ||
runs-on: | ||
required: false | ||
type: string | ||
default: ubuntu-latest | ||
# We needed this input in order to be able to configure out integration tests for this repo, it is not documented | ||
# so as to not cause confusion/add noise, but technically any consumer of the workflow can use it if they want to. | ||
working-directory: | ||
required: false | ||
type: string | ||
|
||
env: | ||
NX_CLOUD_DISTRIBUTED_EXECUTION: true | ||
NX_BRANCH: ${{ github.event.number || github.ref_name }} | ||
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | ||
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} | ||
|
||
jobs: | ||
set-agents: | ||
runs-on: ${{ inputs.runs-on }} | ||
name: Init | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- id: set-matrix | ||
shell: bash | ||
# Turn the number-of-agents input into a JSON structure which is compatible with a Github job matrix strategy | ||
run: | | ||
AGENTS_JSON_ARRAY=$(node -e "console.log(JSON.stringify(Array.from(new Array(${{ inputs.number-of-agents }})).map((_, i) => i + 1)));") | ||
echo $AGENTS_JSON_ARRAY | ||
echo "matrix=$AGENTS_JSON_ARRAY" >> $GITHUB_OUTPUT | ||
# Intentionally using capital letter in order to make the Github UI for the matrix look better | ||
Run: | ||
needs: set-agents | ||
runs-on: ${{ inputs.runs-on }} | ||
name: Agent ${{ matrix.agent }} | ||
strategy: | ||
matrix: | ||
agent: | ||
- ${{fromJson(needs.set-agents.outputs.matrix)}} | ||
defaults: | ||
run: | ||
working-directory: ${{ inputs.working-directory || github.workspace }} | ||
# Specify shell to help normalize across different operating systems | ||
shell: bash | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Detect package manager | ||
id: package_manager | ||
run: | | ||
echo "name=$([[ -f ./yarn.lock ]] && echo "yarn" || ([[ -f ./pnpm-lock.yaml ]] && echo "pnpm") || echo "npm")" >> $GITHUB_OUTPUT | ||
# Set node/npm/yarn versions using volta, with optional overrides provided by the consumer | ||
- uses: volta-cli/action@v4 | ||
with: | ||
node-version: '${{ inputs.node-version }}' | ||
npm-version: '${{ inputs.npm-version }}' | ||
yarn-version: '${{ inputs.yarn-version }}' | ||
|
||
# Install pnpm with exact version provided by consumer or fallback to latest | ||
- name: Install PNPM | ||
if: steps.package_manager.outputs.name == 'pnpm' | ||
uses: pnpm/action-setup@v2.2.2 | ||
with: | ||
version: ${{ inputs.pnpm-version || 'latest' }} | ||
|
||
- name: Print node/npm/yarn versions | ||
id: versions | ||
run: | | ||
node_ver=$( node --version ) | ||
yarn_ver=$( yarn --version || true ) | ||
pnpm_ver=$( pnpm --version || true ) | ||
echo "Node: ${node_ver:1}" | ||
echo "NPM: $( npm --version )" | ||
if [[ $yarn_ver != '' ]]; then echo "Yarn: $yarn_ver"; fi | ||
if [[ $pnpm_ver != '' ]]; then echo "PNPM: $pnpm_ver"; fi | ||
echo "node_version=${node_ver:1}" >> $GITHUB_OUTPUT | ||
- name: Use the node_modules cache if available [npm] | ||
if: steps.package_manager.outputs.name == 'npm' | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}- | ||
- name: Use the node_modules cache if available [pnpm] | ||
if: steps.package_manager.outputs.name == 'pnpm' | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}- | ||
- name: Get yarn cache directory path | ||
if: steps.package_manager.outputs.name == 'yarn' | ||
id: yarn-cache-dir-path | ||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | ||
|
||
- name: Use the node_modules cache if available [yarn] | ||
if: steps.package_manager.outputs.name == 'yarn' | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn- | ||
- name: Process environment-variables | ||
if: ${{ inputs.environment-variables != '' }} | ||
uses: actions/github-script@v6 | ||
env: | ||
ENV_VARS: ${{ inputs.environment-variables }} | ||
with: | ||
script: | | ||
const { appendFileSync } = require('fs'); | ||
// trim spaces and escape quotes | ||
const cleanStr = str => str | ||
.trim() | ||
.replaceAll(/`/g, "\`"); | ||
// parse variable to correct type | ||
const parseStr = str => | ||
str === 'true' || str === 'TRUE' | ||
? true | ||
: str === 'false' || str === 'FALSE' | ||
? false | ||
: isNaN(str) | ||
? str | ||
: parseFloat(str); | ||
const varsStr = process.env.ENV_VARS || ''; | ||
const vars = varsStr | ||
.split('\n') | ||
.map(variable => variable.trim()) | ||
.filter(variable => variable.indexOf('=') > 0) | ||
.map(variable => ({ | ||
name: cleanStr(variable.split('=')[0]), | ||
value: cleanStr(variable.slice(variable.indexOf('=') + 1)) | ||
})); | ||
for (const v of vars) { | ||
console.log(`Appending environment variable \`${v.name}\` with value \`${v.value}\` to ${process.env.GITHUB_ENV}`); | ||
appendFileSync(process.env.GITHUB_ENV, `${v.name}=${parseStr(v.value)}\n`); | ||
} | ||
- name: Run any configured install-commands | ||
if: ${{ inputs.install-commands != '' }} | ||
run: | | ||
${{ inputs.install-commands }} | ||
- name: Install dependencies | ||
if: ${{ inputs.install-commands == '' }} | ||
run: | | ||
if [ "${{ steps.package_manager.outputs.name == 'yarn' }}" == "true" ]; then | ||
echo "Running yarn install --immutable" | ||
yarn install --immutable | ||
elif [ "${{ steps.package_manager.outputs.name == 'pnpm' }}" == "true" ]; then | ||
echo "Running pnpm install --frozen-lockfile" | ||
pnpm install --frozen-lockfile | ||
else | ||
echo "Running npm ci" | ||
npm ci | ||
fi | ||
- name: Start Nx Agent ${{ matrix.agent }} | ||
run: npx nx-cloud start-agent | ||
env: | ||
NX_AGENT_NAME: ${{matrix.agent}} |
Oops, something went wrong.