From ed9b7e27f6f2d72d7b4081e0cade4bb88e8d99e7 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Thu, 26 Oct 2023 19:28:15 +0200 Subject: [PATCH 1/5] Add .nvmrc file Define node version for consistent usage in development environment and CI. It requires installing `nvm` tool and running `nvm install` and `nvm use`. --- core/.nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 core/.nvmrc diff --git a/core/.nvmrc b/core/.nvmrc new file mode 100644 index 000000000..9de225682 --- /dev/null +++ b/core/.nvmrc @@ -0,0 +1 @@ +lts/iron From 9c88d543ee513f294d109d84f63b79d01b65c603 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Thu, 26 Oct 2023 18:52:12 +0200 Subject: [PATCH 2/5] Define GitHub Actions workflow for Core module This is an initial implementation of the CI process to check formatting, build contracts, test them and run deployment with local hardhat network. --- .github/workflows/core.yaml | 109 ++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 .github/workflows/core.yaml diff --git a/.github/workflows/core.yaml b/.github/workflows/core.yaml new file mode 100644 index 000000000..d95368ddf --- /dev/null +++ b/.github/workflows/core.yaml @@ -0,0 +1,109 @@ +name: Core + +on: + push: + branches: + - main + paths: + - "core/**" + pull_request: + +defaults: + run: + working-directory: ./core + +jobs: + core-format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version-file: "core/.nvmrc" + cache: "yarn" + cache-dependency-path: "core/yarn.lock" + + - name: Install Dependencies + run: yarn install --prefer-offline --frozen-lockfile + + - name: Format + run: yarn format + + core-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version-file: "core/.nvmrc" + cache: "yarn" + cache-dependency-path: "core/yarn.lock" + + - name: Install Dependencies + run: yarn install --prefer-offline --frozen-lockfile + + - name: Build + run: yarn build + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: core-build + path: | + core/build/ + core/typechain/ + if-no-files-found: error + + core-test: + needs: [core-build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version-file: "core/.nvmrc" + cache: "yarn" + cache-dependency-path: "core/yarn.lock" + + - name: Install Dependencies + run: yarn install --prefer-offline --frozen-lockfile + + - name: Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: core-build + path: core/ + + - name: Test + run: yarn test --no-compile + + core-deploy-dry-run: + needs: [core-build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version-file: "core/.nvmrc" + cache: "yarn" + cache-dependency-path: "core/yarn.lock" + + - name: Install Dependencies + run: yarn install --prefer-offline --frozen-lockfile + + - name: Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: core-build + path: core/ + + - name: Deploy + run: yarn deploy --no-compile From 694105d7895dcf5344e834b12511866d36572974 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Thu, 26 Oct 2023 19:54:55 +0200 Subject: [PATCH 3/5] Add a CI badge for core The badge shows CI status of the core module on main branch. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 14fe49a09..edc2ef8e4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # litmus + Bitcoin Liquid Staking + +[![Core](https://github.com/thesis/litmus/actions/workflows/core.yaml/badge.svg?branch=main&event=push)](https://github.com/thesis/litmus/actions/workflows/core.yaml) From 8e5ec57bce3db9d33ed34e73adbf0c3ef48854c3 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Wed, 1 Nov 2023 12:15:58 +0100 Subject: [PATCH 4/5] Use actions/setup-node@v4 Use the latest version of actions/setup-node. --- .github/workflows/core.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/core.yaml b/.github/workflows/core.yaml index d95368ddf..90b8fe55e 100644 --- a/.github/workflows/core.yaml +++ b/.github/workflows/core.yaml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v3 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: "core/.nvmrc" cache: "yarn" @@ -37,7 +37,7 @@ jobs: - uses: actions/checkout@v3 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: "core/.nvmrc" cache: "yarn" @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v3 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: "core/.nvmrc" cache: "yarn" @@ -90,7 +90,7 @@ jobs: - uses: actions/checkout@v3 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: "core/.nvmrc" cache: "yarn" From ac41146f06992c4fd0d0a4891c6380bfcb7d4ba3 Mon Sep 17 00:00:00 2001 From: Jakub Nowakowski Date: Wed, 1 Nov 2023 12:17:35 +0100 Subject: [PATCH 5/5] Use actions/checkout@v4 Use the latest version of actions/checkout. --- .github/workflows/core.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/core.yaml b/.github/workflows/core.yaml index 90b8fe55e..7addece4a 100644 --- a/.github/workflows/core.yaml +++ b/.github/workflows/core.yaml @@ -16,7 +16,7 @@ jobs: core-format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Node uses: actions/setup-node@v4 @@ -34,7 +34,7 @@ jobs: core-build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Node uses: actions/setup-node@v4 @@ -62,7 +62,7 @@ jobs: needs: [core-build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Node uses: actions/setup-node@v4 @@ -87,7 +87,7 @@ jobs: needs: [core-build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Node uses: actions/setup-node@v4