2021-03-15 03:42:36 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2022-05-02 06:32:56 +00:00
|
|
|
- "master"
|
|
|
|
- "staging"
|
|
|
|
- "trying"
|
2021-03-15 03:42:36 +00:00
|
|
|
pull_request:
|
|
|
|
|
2022-08-19 08:28:57 +00:00
|
|
|
env:
|
|
|
|
NIM_WAKU_VERSION: "v0.9"
|
|
|
|
NODE_JS: "16"
|
|
|
|
|
2021-03-15 03:42:36 +00:00
|
|
|
jobs:
|
|
|
|
build_and_test:
|
2022-08-19 13:16:16 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-03-15 03:42:36 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2022-08-19 13:19:33 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-03-15 03:42:36 +00:00
|
|
|
|
2022-01-10 01:39:37 +00:00
|
|
|
- name: Get nim-waku
|
2021-03-18 23:31:26 +00:00
|
|
|
shell: bash
|
2022-01-10 01:39:37 +00:00
|
|
|
run: |
|
|
|
|
mkdir -p nim-waku/build
|
|
|
|
cd nim-waku
|
2022-01-19 04:43:45 +00:00
|
|
|
wget "https://github.com/status-im/nim-waku/releases/download/${NIM_WAKU_VERSION}/nim-waku-ubuntu-latest.tar.gz"
|
2022-01-10 01:39:37 +00:00
|
|
|
tar xavf nim-waku-ubuntu-latest.tar.gz
|
2021-03-15 06:50:38 +00:00
|
|
|
|
2021-04-14 02:06:56 +00:00
|
|
|
- name: Install NodeJS
|
2022-08-19 08:26:46 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-04-14 02:06:56 +00:00
|
|
|
with:
|
2022-08-19 08:28:57 +00:00
|
|
|
node-version: ${{ env.NODE_JS }}
|
2021-04-14 02:06:56 +00:00
|
|
|
|
2021-03-26 03:12:16 +00:00
|
|
|
- name: Ensure wakunode2 is ready
|
|
|
|
shell: bash
|
2022-04-01 02:07:01 +00:00
|
|
|
run: |
|
|
|
|
uname -a
|
|
|
|
cd nim-waku/build
|
|
|
|
./wakunode2 --help
|
2021-03-26 03:12:16 +00:00
|
|
|
|
2021-03-15 03:50:52 +00:00
|
|
|
- name: install using npm ci
|
|
|
|
uses: bahmutov/npm-install@v1
|
2021-03-15 03:42:36 +00:00
|
|
|
|
2021-04-20 00:02:47 +00:00
|
|
|
- name: Generate protobuf code
|
2022-05-30 05:25:00 +00:00
|
|
|
run: |
|
|
|
|
npm run proto
|
|
|
|
npm run fix
|
2021-04-20 00:02:47 +00:00
|
|
|
|
|
|
|
- name: Check all protobuf code was committed
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-01-04 22:05:07 +00:00
|
|
|
res=$(git status --short --ignore-submodules)
|
|
|
|
echo -n "'$res'" # For debug purposes
|
|
|
|
[ $(echo -n "$res"|wc -l) -eq 0 ]
|
2021-04-20 00:02:47 +00:00
|
|
|
|
2021-03-15 03:42:36 +00:00
|
|
|
- name: build
|
2021-03-15 04:39:55 +00:00
|
|
|
run: npm run build
|
2021-03-15 03:42:36 +00:00
|
|
|
|
|
|
|
- name: test
|
2021-05-10 10:18:26 +00:00
|
|
|
env:
|
|
|
|
DEBUG: "waku:nim-waku*,waku:test*"
|
2021-03-15 04:39:55 +00:00
|
|
|
run: npm run test
|
2021-03-26 01:38:04 +00:00
|
|
|
|
|
|
|
- name: Upload logs on failure
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: nim-waku-logs
|
|
|
|
path: log/
|
2022-08-19 09:22:35 +00:00
|
|
|
|
|
|
|
release_next:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
|
|
needs: [build_and_test]
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2.3.3
|
|
|
|
|
|
|
|
- name: Install NodeJS
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_JS }}
|
|
|
|
|
|
|
|
- name: install using npm ci
|
|
|
|
uses: bahmutov/npm-install@v1
|
|
|
|
|
|
|
|
- name: Append git hash to version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
CURR_VERSION=$(cat package.json | jq .version | tr -d '"')
|
|
|
|
GIT_HASH=$(git rev-parse --short HEAD)
|
|
|
|
cat package.json| jq --arg version "$CURR_VERSION-$GIT_HASH" '.version |= $version' > _package.json
|
|
|
|
mv -f _package.json package.json
|
|
|
|
|
|
|
|
- name: Authenticate with registry
|
|
|
|
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ./.npmrc
|
|
|
|
|
|
|
|
- name: publish
|
|
|
|
run: npm publish --tag next --access public
|