Add Dependabot configuration (#245) #796
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: Continuous Integration | |
on: | |
pull_request: | |
branches: [main, 'credo-**'] | |
types: [opened, synchronize, reopened, labeled] | |
push: | |
branches: [main, 'credo-**'] | |
env: | |
TEST_AGENT_PUBLIC_DID_SEED: 000000000000000000000000Trustee9 | |
GENESIS_TXN_PATH: network/genesis/local-genesis.txn | |
# Make sure we're not running multiple release steps at the same time as this can give issues with determining the next npm version to release. | |
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case: | |
# "When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other." | |
concurrency: | |
group: credo-ts-${{ github.ref }}-${{ github.repository }}-${{ github.event_name }} | |
cancel-in-progress: true | |
jobs: | |
ci-trigger: | |
runs-on: ubuntu-20.04 | |
outputs: | |
triggered: ${{ steps.check.outputs.triggered }} | |
steps: | |
- name: Determine if CI should run | |
id: check | |
run: | | |
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "ci-test" ]]; then | |
export SHOULD_RUN='true' | |
elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" != "ci-test" ]]; then | |
export SHOULD_RUN='false' | |
else | |
export SHOULD_RUN='true' | |
fi | |
echo "SHOULD_RUN: ${SHOULD_RUN}" | |
echo "::set-output name=triggered::${SHOULD_RUN}" | |
validate: | |
runs-on: ubuntu-20.04 | |
name: Validate | |
needs: [ci-trigger] | |
if: needs.ci-trigger.outputs.triggered == 'true' | |
steps: | |
- name: Checkout credo-ts-ext | |
uses: actions/checkout@v4 | |
- name: Setup node v18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org/' | |
cache: yarn | |
# Ignore scripts so we don't need libindy setup | |
- name: Install dependencies | |
run: yarn install --ignore-scripts | |
- name: Linting | |
run: yarn lint | |
- name: Prettier | |
run: yarn check-format | |
- name: Compile | |
run: yarn check-types | |
integration-test: | |
runs-on: ubuntu-20.04 | |
name: Integration Tests | |
needs: [ci-trigger] | |
if: needs.ci-trigger.outputs.triggered == 'true' | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout credo-ts-ext | |
uses: actions/checkout@v4 | |
# setup dependencies | |
- name: Setup Libindy | |
uses: ./.github/actions/setup-libindy | |
- name: Setup Indy Pool | |
uses: ./.github/actions/setup-indy-pool | |
with: | |
seed: ${TEST_AGENT_PUBLIC_DID_SEED} | |
- name: Setup node ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://registry.npmjs.org/' | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install | |
- name: Run tests for Push notifications | |
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test push-notifications --coverage | |
- name: Run tests for React hooks | |
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test react-hooks --coverage | |
- name: Run tests for Redux store | |
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test redux-store --coverage | |
- name: Run tests for Rest | |
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test rest --coverage | |
- uses: codecov/codecov-action@v1 | |
if: always() | |
package-finder: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.repository == 'openwallet-foundation/credo-ts-ext' && github.event_name == 'push' | |
needs: [integration-test, validate] | |
outputs: | |
packages: ${{ steps.get-packages.outputs.packages }} | |
steps: | |
- name: Checkout credo-ts-ext | |
uses: actions/checkout@v4 | |
- name: Setup node v18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org/' | |
cache: yarn | |
# Ignore scripts so we don't need libindy setup | |
- name: Install dependencies | |
run: yarn install --ignore-scripts | |
- id: get-packages | |
name: Get all NPM packages | |
run: yarn ts-node ./scripts/getPackages.ts | |
release-please: | |
runs-on: ubuntu-latest | |
needs: [package-finder] | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ${{fromJson(needs.package-finder.outputs.packages)}} | |
steps: | |
- uses: google-github-actions/release-please-action@v2 | |
id: release-please | |
with: | |
path: packages/${{ matrix.package }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: node | |
package-name: ${{ matrix.package }} | |
bump-minor-pre-major: true | |
bump-patch-for-minor-pre-major: true | |
monorepo-tags: true | |
signoff: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' | |
# Initiate release process if release was created | |
- name: Checkout credo-ts-ext | |
uses: actions/checkout@v4 | |
if: ${{ steps.release-please.outputs.release_created }} | |
- name: Setup node v18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org/' | |
cache: yarn | |
if: ${{ steps.release-please.outputs.release_created }} | |
# Ignore scripts so we don't need libindy setup | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile --ignore-scripts | |
if: ${{ steps.release-please.outputs.release_created }} | |
- name: Release to NPM | |
run: npm publish ./packages/${{ matrix.package }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }} | |
if: ${{ steps.release-please.outputs.release_created }} |