|
1 |
| -name: Build and check the code format |
| 1 | +name: Build and check |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: |
6 |
| - - '*' |
7 |
| - pull_request_target: |
8 |
| - types: |
9 |
| - - opened |
10 |
| - - synchronize |
11 |
| - - reopened |
12 |
| - - edited |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '*' |
| 7 | + pull_request_target: |
| 8 | + types: |
| 9 | + - opened |
| 10 | + - synchronize |
| 11 | + - reopened |
| 12 | + - edited |
| 13 | + |
13 | 14 | env:
|
14 |
| - GITLAB_NPM_TOKEN: ${{secrets.GITLAB_NPM_TOKEN}} |
| 15 | + GITLAB_NPM_TOKEN: ${{secrets.GITLAB_NPM_TOKEN}} |
| 16 | + |
15 | 17 | jobs:
|
16 |
| - lint: |
17 |
| - permissions: read-all |
18 |
| - runs-on: ubuntu-latest |
19 |
| - strategy: |
20 |
| - matrix: |
21 |
| - node-version: [16.x] |
22 |
| - steps: |
23 |
| - - uses: actions/checkout@v2 |
24 |
| - with: |
25 |
| - ref: ${{ github.event.pull_request.head.sha }} |
26 |
| - - name: Use Node.js ${{ matrix.node-version }} |
27 |
| - uses: actions/setup-node@v2 |
28 |
| - with: |
29 |
| - node-version: ${{ matrix.node-version }} |
30 |
| - cache: 'npm' |
31 |
| - - name: 'Installing Dependencies' |
32 |
| - run: npm ci |
33 |
| - - name: 'Linting' |
34 |
| - run: npm run lint |
35 |
| - - name: 'Testing(Unit)' |
36 |
| - run: npm run test:unit |
37 |
| - package: |
38 |
| - strategy: |
39 |
| - matrix: |
40 |
| - include: |
41 |
| - - os: windows-latest |
42 |
| - platform: win32 |
43 |
| - arch: x64 |
44 |
| - npm_config_arch: x64 |
45 |
| - - os: windows-latest |
46 |
| - platform: win32 |
47 |
| - arch: ia32 |
48 |
| - npm_config_arch: ia32 |
49 |
| - - os: windows-latest |
50 |
| - platform: win32 |
51 |
| - arch: arm64 |
52 |
| - npm_config_arch: arm |
53 |
| - - os: ubuntu-latest |
54 |
| - platform: linux |
55 |
| - arch: x64 |
56 |
| - npm_config_arch: x64 |
57 |
| - - os: ubuntu-latest |
58 |
| - platform: linux |
59 |
| - arch: arm64 |
60 |
| - npm_config_arch: arm64 |
61 |
| - - os: ubuntu-latest |
62 |
| - platform: linux |
63 |
| - arch: armhf |
64 |
| - npm_config_arch: arm |
65 |
| - - os: ubuntu-latest |
66 |
| - platform: alpine |
67 |
| - arch: x64 |
68 |
| - npm_config_arch: x64 |
69 |
| - - os: macos-latest |
70 |
| - platform: darwin |
71 |
| - arch: x64 |
72 |
| - npm_config_arch: x64 |
73 |
| - - os: macos-latest |
74 |
| - platform: darwin |
75 |
| - arch: arm64 |
76 |
| - npm_config_arch: arm64 |
77 |
| - runs-on: ${{ matrix.os }} |
78 |
| - needs: lint |
79 |
| - env: |
80 |
| - npm_config_arch: ${{ matrix.npm_config_arch }} |
81 |
| - steps: |
82 |
| - - uses: actions/checkout@v2 |
83 |
| - with: |
84 |
| - ref: ${{ github.event.pull_request.head.sha }} |
85 |
| - - name: Use Node.js |
86 |
| - uses: actions/setup-node@v2 |
87 |
| - with: |
88 |
| - node-version: 16.x |
89 |
| - cache: 'npm' |
90 |
| - |
91 |
| - - name: 'Installing Dependencies' |
92 |
| - run: npm ci |
93 |
| - |
94 |
| - - name: Building |
95 |
| - run: npm run package -- --env CLIENTID=${{ secrets.OAUTHCLIENTID }} --env CLIENTSECRET=${{ secrets.OAUTHCLIENTSECRET }} && npm run ui:package |
96 |
| - |
97 |
| - - name: 'Versioning' |
98 |
| - id: version |
99 |
| - shell: bash |
100 |
| - run: echo "VERSION=1.0.0-beta.$(date +%s)" >> $GITHUB_OUTPUT |
101 |
| - |
102 |
| - - id: targeting |
103 |
| - name: Targeting |
104 |
| - shell: pwsh |
105 |
| - run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_OUTPUT |
106 |
| - |
107 |
| - - name: Packaging |
108 |
| - id: packaging |
109 |
| - run: | |
110 |
| - npx @vscode/vsce package --pre-release --target ${{ steps.targeting.outputs.target }} --no-update-package-json --no-git-tag-version ${{ steps.version.outputs.VERSION }} |
111 |
| - - uses: actions/upload-artifact@v2 |
112 |
| - with: |
113 |
| - name: ${{ steps.targeting.outputs.target }} |
114 |
| - path: '*.vsix' |
| 18 | + rust-lint: |
| 19 | + permissions: read-all |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Check out |
| 24 | + uses: actions/checkout@v3 |
| 25 | + |
| 26 | + - name: Step rust toolchain |
| 27 | + uses: actions-rs/toolchain@v1 |
| 28 | + with: |
| 29 | + profile: minimal |
| 30 | + override: true |
| 31 | + toolchain: nightly-2023-06-09 |
| 32 | + components: rustfmt, clippy |
| 33 | + |
| 34 | + - name: Setup rust cache |
| 35 | + uses: Swatinem/rust-cache@v2 |
| 36 | + with: |
| 37 | + workspaces: "rs" |
| 38 | + |
| 39 | + - name: Fmt |
| 40 | + working-directory: rs |
| 41 | + run: cargo fmt |
| 42 | + |
| 43 | + - name: Clippy |
| 44 | + working-directory: rs |
| 45 | + run: cargo clippy |
| 46 | + |
| 47 | + - name: Test |
| 48 | + working-directory: rs |
| 49 | + run: cargo test --verbose |
| 50 | + |
| 51 | + - name: Test release |
| 52 | + working-directory: rs |
| 53 | + run: cargo test --verbose --release |
| 54 | + |
| 55 | + node-lint: |
| 56 | + permissions: read-all |
| 57 | + runs-on: ubuntu-latest |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Check out |
| 61 | + uses: actions/checkout@v3 |
| 62 | + with: |
| 63 | + ref: ${{ github.event.pull_request.head.sha }} |
| 64 | + |
| 65 | + - name: Setup node.js |
| 66 | + uses: actions/setup-node@v3 |
| 67 | + with: |
| 68 | + node-version: 16.x |
| 69 | + cache: 'npm' |
| 70 | + |
| 71 | + - name: Step rust toolchain |
| 72 | + uses: actions-rs/toolchain@v1 |
| 73 | + with: |
| 74 | + profile: minimal |
| 75 | + override: true |
| 76 | + toolchain: nightly-2023-06-09 |
| 77 | + |
| 78 | + - name: Setup wasm-pack |
| 79 | + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh |
| 80 | + |
| 81 | + - name: Setup rust cache |
| 82 | + uses: Swatinem/rust-cache@v2 |
| 83 | + with: |
| 84 | + workspaces: "rs" |
| 85 | + |
| 86 | + - name: Build wasm |
| 87 | + run: ./build-wasm.sh |
| 88 | + |
| 89 | + - name: Install |
| 90 | + run: npm ci |
| 91 | + |
| 92 | + - name: Lint |
| 93 | + run: npm run lint |
| 94 | + |
| 95 | + - name: Test |
| 96 | + run: npm run test:unit |
| 97 | + |
| 98 | + package: |
| 99 | + strategy: |
| 100 | + matrix: |
| 101 | + include: |
| 102 | + - os: windows-latest |
| 103 | + platform: win32 |
| 104 | + arch: x64 |
| 105 | + npm_config_arch: x64 |
| 106 | + # - os: windows-latest |
| 107 | + # platform: win32 |
| 108 | + # arch: ia32 |
| 109 | + # npm_config_arch: ia32 |
| 110 | + # - os: windows-latest |
| 111 | + # platform: win32 |
| 112 | + # arch: arm64 |
| 113 | + # npm_config_arch: arm |
| 114 | + - os: ubuntu-latest |
| 115 | + platform: linux |
| 116 | + arch: x64 |
| 117 | + npm_config_arch: x64 |
| 118 | + # - os: ubuntu-latest |
| 119 | + # platform: linux |
| 120 | + # arch: arm64 |
| 121 | + # npm_config_arch: arm64 |
| 122 | + # - os: ubuntu-latest |
| 123 | + # platform: linux |
| 124 | + # arch: armhf |
| 125 | + # npm_config_arch: arm |
| 126 | + # - os: ubuntu-latest |
| 127 | + # platform: alpine |
| 128 | + # arch: x64 |
| 129 | + # npm_config_arch: x64 |
| 130 | + - os: macos-latest |
| 131 | + platform: darwin |
| 132 | + arch: x64 |
| 133 | + npm_config_arch: x64 |
| 134 | + # - os: macos-latest |
| 135 | + # platform: darwin |
| 136 | + # arch: arm64 |
| 137 | + # npm_config_arch: arm64 |
| 138 | + |
| 139 | + runs-on: ${{ matrix.os }} |
| 140 | + needs: [ rust-lint, node-lint ] |
| 141 | + |
| 142 | + env: |
| 143 | + npm_config_arch: ${{ matrix.npm_config_arch }} |
| 144 | + |
| 145 | + steps: |
| 146 | + - name: Check out |
| 147 | + uses: actions/checkout@v3 |
| 148 | + with: |
| 149 | + ref: ${{ github.event.pull_request.head.sha }} |
| 150 | + |
| 151 | + - name: Setup node.js |
| 152 | + uses: actions/setup-node@v3 |
| 153 | + with: |
| 154 | + node-version: 16.x |
| 155 | + cache: 'npm' |
| 156 | + |
| 157 | + - name: Step rust toolchain |
| 158 | + uses: actions-rs/toolchain@v1 |
| 159 | + with: |
| 160 | + profile: minimal |
| 161 | + override: true |
| 162 | + toolchain: nightly-2023-06-09 |
| 163 | + |
| 164 | + - name: Setup wasm-pack |
| 165 | + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh |
| 166 | + |
| 167 | + - name: Setup rust cache |
| 168 | + uses: Swatinem/rust-cache@v2 |
| 169 | + with: |
| 170 | + workspaces: "rs" |
| 171 | + |
| 172 | + - name: NPM install |
| 173 | + run: npm ci |
| 174 | + |
| 175 | + - name: Build wasm |
| 176 | + run: wasm-pack build rs --target=nodejs --out-dir ../src/wasm |
| 177 | + |
| 178 | + - name: Build node |
| 179 | + run: | |
| 180 | + npm run package -- --env CLIENTID="${{ secrets.OAUTHCLIENTID }}" --env CLIENTSECRET="${{ secrets.OAUTHCLIENTSECRET }}" && npm run ui:package |
| 181 | +
|
| 182 | + - name: Version |
| 183 | + id: version |
| 184 | + shell: bash |
| 185 | + run: echo "VERSION=1.0.0-beta.$(date +%s)" >> $GITHUB_OUTPUT |
| 186 | + |
| 187 | + - name: Target |
| 188 | + id: target |
| 189 | + shell: bash |
| 190 | + run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT |
| 191 | + |
| 192 | + - name: Package |
| 193 | + run: | |
| 194 | + npx @vscode/vsce package --pre-release --target ${{ steps.target.outputs.target }} --no-update-package-json --no-git-tag-version ${{ steps.version.outputs.VERSION }} |
| 195 | +
|
| 196 | + - name: Upload artifact |
| 197 | + uses: actions/upload-artifact@v3 |
| 198 | + with: |
| 199 | + name: ${{ steps.target.outputs.target }} |
| 200 | + path: '*.vsix' |
0 commit comments