Update idea-frontend (major) - autoclosed #6189
Workflow file for this run
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-CD @gear-js/api' | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, labeled] | |
branches: [main] | |
push: | |
branches: [main] | |
paths: | |
- api/** | |
workflow_dispatch: | |
env: | |
NIGHTLY_TOOLCHAIN_VERSION: ${{ vars.NIGHTLY_TOOLCHAIN_VERSION }} | |
jobs: | |
test: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-22.04 | |
env: | |
RUSTUP_HOME: /tmp/rustup_home | |
steps: | |
- name: Cancel previous workflow runs | |
uses: styfle/cancel-workflow-action@0.4.0 | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v3 | |
- name: "Install: NodeJS 18.x" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: "Install: Set cargo path" | |
run: echo "/tmp/cargo/bin" >> $GITHUB_PATH | |
- name: "Install: Nightly toolchain" | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
target: wasm32-unknown-unknown | |
components: llvm-tools-preview | |
- name: "Install: Show specific nightly version" | |
if: ${{ env.NIGHTLY_TOOLCHAIN_VERSION != '' }} | |
run: echo $NIGHTLY_TOOLCHAIN_VERSION | sed 's/-/ - /g' | |
- name: "Install: Specific nightly toolchain" | |
if: ${{ env.NIGHTLY_TOOLCHAIN_VERSION != '' }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly-${{ env.NIGHTLY_TOOLCHAIN_VERSION }} | |
target: wasm32-unknown-unknown | |
components: llvm-tools-preview | |
- name: "Install: Pin to specific nightly toolchain" | |
if: ${{ env.NIGHTLY_TOOLCHAIN_VERSION != '' }} | |
run: | | |
rm -rf $RUSTUP_HOME/toolchains/nightly-x86_64-unknown-linux-gnu | |
ln -s $RUSTUP_HOME/toolchains/nightly-$NIGHTLY_TOOLCHAIN_VERSION-x86_64-unknown-linux-gnu $RUSTUP_HOME/toolchains/nightly-x86_64-unknown-linux-gnu | |
- name: "Install: pkg dependencies" | |
working-directory: api | |
run: yarn install | |
- name: "Build: @gear-js/api" | |
working-directory: api | |
run: yarn build | |
- name: "Prepare: build programs" | |
working-directory: api/programs | |
run: cargo build --release --locked | |
- name: "Prepare: download Gear examples" | |
working-directory: api/test/wasm | |
run: | | |
mkdir examples | |
cd examples | |
wget -O ./examples.tar.gz https://github.com/gear-tech/gear/releases/download/build/examples.tar.gz | |
tar -xvf examples.tar.gz | |
- name: "Prepare: run Gear node" | |
run: | | |
wget -O ./gear https://github.com/gear-tech/gear/releases/download/build/gear | |
chmod +x gear | |
nohup ./gear --dev --execution=wasm --tmp --unsafe-ws-external --unsafe-rpc-external --rpc-methods Unsafe --rpc-cors all & | |
- name: "Test: run" | |
working-directory: api | |
run: yarn test | |
publish-to-npm: | |
if: github.event_name == 'push' | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use node 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Check package version | |
uses: EndBug/version-check@v1 | |
id: check | |
with: | |
file-name: api/package.json | |
file-url: https://unpkg.com/@gear-js/api@latest/package.json | |
static-checking: localIsNew | |
- name: Install dependencies | |
if: steps.check.outputs.changed == 'true' | |
working-directory: api | |
run: yarn install | |
- name: Build @gear-js/api | |
if: steps.check.outputs.changed == 'true' | |
working-directory: api | |
run: yarn build | |
- name: Publish | |
if: steps.check.outputs.changed == 'true' | |
working-directory: api/lib | |
run: | | |
export token=$(printenv $(printenv GITHUB_ACTOR)) | |
npm config set //registry.npmjs.org/:_authToken=$token | |
npm publish | |
env: | |
osipov-mit: ${{ secrets.OSIPOV_NPM_TOKEN }} |