|
| 1 | +name: Publish Bolt Lang |
| 2 | +on: |
| 3 | + release: |
| 4 | + types: [published] |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +env: |
| 8 | + solana_version: v1.17.0 |
| 9 | + anchor_version: 0.29.0 |
| 10 | + |
| 11 | +jobs: |
| 12 | + install: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - uses: actions/cache@v3 |
| 18 | + name: cache solana cli |
| 19 | + id: cache-solana |
| 20 | + with: |
| 21 | + path: | |
| 22 | + ~/.cache/solana/ |
| 23 | + ~/.local/share/solana/ |
| 24 | + key: solana-${{ runner.os }}-v0000-${{ env.solana_version }} |
| 25 | + |
| 26 | + - uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version: 20 |
| 29 | + |
| 30 | + - name: install essentials |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y pkg-config build-essential libudev-dev |
| 34 | +
|
| 35 | + - name: Cache node dependencies |
| 36 | + uses: actions/cache@v3 |
| 37 | + with: |
| 38 | + path: '**/node_modules' |
| 39 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} |
| 40 | + |
| 41 | + - name: install node_modules |
| 42 | + run: | |
| 43 | + export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" |
| 44 | + yarn --frozen-lockfile --network-concurrency 2 |
| 45 | +
|
| 46 | + - uses: dtolnay/rust-toolchain@stable |
| 47 | + with: |
| 48 | + toolchain: stable |
| 49 | + |
| 50 | + - name: Cache rust |
| 51 | + uses: Swatinem/rust-cache@v2 |
| 52 | + |
| 53 | + - name: install solana |
| 54 | + if: steps.cache-solana.outputs.cache-hit != 'true' |
| 55 | + run: | |
| 56 | + sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)" |
| 57 | + export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH" |
| 58 | + solana --version |
| 59 | +
|
| 60 | + clippy-lint: |
| 61 | + needs: install |
| 62 | + runs-on: ubuntu-latest |
| 63 | + |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v3 |
| 66 | + - name: Cache rust |
| 67 | + uses: Swatinem/rust-cache@v2 |
| 68 | + - name: Run fmt |
| 69 | + run: cargo fmt -- --check |
| 70 | + - name: Run clippy |
| 71 | + run: cargo clippy -- --deny=warnings |
| 72 | + |
| 73 | + yarn-lint: |
| 74 | + needs: install |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v3 |
| 78 | + - name: Use Node ${{ matrix.node }} |
| 79 | + uses: actions/setup-node@v3 |
| 80 | + with: |
| 81 | + node-version: 20 |
| 82 | + |
| 83 | + - name: Cache node dependencies |
| 84 | + uses: actions/cache@v3 |
| 85 | + with: |
| 86 | + path: '**/node_modules' |
| 87 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} |
| 88 | + |
| 89 | + - name: Run lint |
| 90 | + run: yarn lint |
| 91 | + |
| 92 | + test-and-publish: |
| 93 | + needs: [clippy-lint, yarn-lint] |
| 94 | + runs-on: ubuntu-latest |
| 95 | + |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v3 |
| 98 | + |
| 99 | + - name: Use Node ${{ matrix.node }} |
| 100 | + uses: actions/setup-node@v3 |
| 101 | + with: |
| 102 | + node-version: 20 |
| 103 | + |
| 104 | + - name: Cache node dependencies |
| 105 | + uses: actions/cache@v3 |
| 106 | + with: |
| 107 | + path: '**/node_modules' |
| 108 | + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} |
| 109 | + - name: install node_modules |
| 110 | + run: | |
| 111 | + export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" |
| 112 | + yarn --frozen-lockfile |
| 113 | +
|
| 114 | + - uses: actions/cache@v3 |
| 115 | + name: cache solana cli |
| 116 | + id: cache-solana |
| 117 | + with: |
| 118 | + path: | |
| 119 | + ~/.cache/solana/ |
| 120 | + ~/.local/share/solana/ |
| 121 | + key: solana-${{ runner.os }}-v0000-${{ env.solana_version }} |
| 122 | + |
| 123 | + - name: setup solana |
| 124 | + run: | |
| 125 | + export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" |
| 126 | + solana --version |
| 127 | + solana-keygen new --silent --no-bip39-passphrase |
| 128 | +
|
| 129 | + - name: Set deployments keys |
| 130 | + run: | |
| 131 | + mkdir -p target/deploy |
| 132 | + echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json |
| 133 | + echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json |
| 134 | + echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json |
| 135 | + echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json |
| 136 | + echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json |
| 137 | + echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json |
| 138 | + echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json |
| 139 | + echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json |
| 140 | +
|
| 141 | + - name: run tests |
| 142 | + run: | |
| 143 | + export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" |
| 144 | + ls node_modules/.bin |
| 145 | + npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript |
| 146 | + anchor test |
| 147 | +
|
| 148 | + - name: cargo publish |
| 149 | + run: | |
| 150 | + cargo publish --manifest-path=crates/bolt-lang/attribute/account/Cargo.toml --token ${CRATES_TOKEN} |
| 151 | + cargo publish --manifest-path=crates/bolt-lang/attribute/component/Cargo.toml --token ${CRATES_TOKEN} |
| 152 | + cargo publish --manifest-path=crates/bolt-lang/attribute/component-deserialize/Cargo.toml --token ${CRATES_TOKEN} |
| 153 | + cargo publish --manifest-path=crates/bolt-lang/attribute/system/Cargo.toml --token ${CRATES_TOKEN} |
| 154 | + cargo publish --manifest-path=programs/bolt-system/Cargo.toml --token ${CRATES_TOKEN} |
| 155 | + cargo publish --manifest-path=programs/bolt-component/Cargo.toml --token ${CRATES_TOKEN} |
| 156 | + cargo publish --manifest-path=programs/world/Cargo.toml --token ${CRATES_TOKEN} |
| 157 | + cargo publish --manifest-path=crates/bolt-lang/Cargo.toml --token ${CRATES_TOKEN} |
| 158 | + env: |
| 159 | + CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} |
0 commit comments