This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
235 - Gas Estimation #494
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: CI | |
on: | |
pull_request: | |
jobs: | |
setup: | |
uses: ./.github/workflows/detect-workspace-changes.yml | |
with: | |
from: ${{ github.head_ref }} | |
since: ${{ github.base_ref }} | |
flatten-deps: | |
runs-on: ubuntu-latest | |
needs: setup | |
outputs: | |
dependencies: ${{ toJson(fromJson(steps.flatten.outputs.result).dependencies) }} | |
steps: | |
- uses: actions/github-script@v6 | |
id: flatten | |
with: | |
script: | | |
const rawExtensions = `${{ needs.setup.outputs.extensions }}` | |
const rawLibraries = `${{ needs.setup.outputs.libraries }}` | |
const rawPackages = `${{ needs.setup.outputs.packages }}` | |
const extensions = JSON.parse(rawExtensions) | |
const libraries = JSON.parse(rawLibraries) | |
const packages = JSON.parse(rawPackages) | |
console.log(extensions, libraries, packages); | |
const deps = [...extensions, ...libraries, ...packages] | |
return { | |
dependencies: deps | |
} | |
lint: | |
runs-on: ubuntu-latest | |
needs: flatten-deps | |
if: ${{ needs.flatten-deps.outputs.dependencies != '[]' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
workspace: ${{ fromJson(needs.flatten-deps.outputs.dependencies) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- name: Setup yarn | |
id: setup-yarn | |
run: | | |
corepack enable | |
corepack prepare yarn@stable --activate | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: yarn install --immutable | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
- run: yarn workspace ${{ matrix.workspace.name }} run lint | |
format: | |
runs-on: ubuntu-latest | |
needs: flatten-deps | |
if: ${{ needs.flatten-deps.outputs.dependencies != '[]' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
workspace: ${{ fromJson(needs.flatten-deps.outputs.dependencies) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- name: Setup yarn | |
id: setup-yarn | |
run: | | |
corepack enable | |
corepack prepare yarn@stable --activate | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- run: yarn install --immutable | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
- run: yarn workspace ${{ matrix.workspace.name }} run format | |
build: | |
needs: flatten-deps | |
if: ${{ needs.flatten-deps.outputs.dependencies != '[]' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
workspace: ${{ fromJson(needs.flatten-deps.outputs.dependencies) }} | |
uses: ./.github/workflows/build.yml | |
with: | |
workspace: ${{ matrix.workspace.name }} | |
secrets: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
test: | |
needs: flatten-deps | |
if: ${{ needs.flatten-deps.outputs.dependencies != '[]' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
workspace: ${{ fromJson(needs.flatten-deps.outputs.dependencies) }} | |
uses: ./.github/workflows/test.yml | |
with: | |
workspace: ${{ matrix.workspace.name }} | |
secrets: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
VSCE_PAT: ${{ secrets.VSCE_PAT }} |