fix(cli): workflow file generated by new command

This commit is contained in:
LongYinan 2021-10-27 15:01:08 +08:00
parent c5cebec812
commit cbb71a9a51
2 changed files with 63 additions and 39 deletions

View file

@ -24,7 +24,9 @@ jobs:
settings: settings:
- host: macos-latest - host: macos-latest
target: 'x86_64-apple-darwin' target: 'x86_64-apple-darwin'
build: yarn build build: |
yarn build
strip -x *.node
- host: windows-latest - host: windows-latest
build: yarn build build: yarn build
target: 'x86_64-pc-windows-msvc' target: 'x86_64-pc-windows-msvc'
@ -55,7 +57,9 @@ jobs:
build: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip ${app}.linux-x64-musl.node build: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip ${app}.linux-x64-musl.node
- host: macos-latest - host: macos-latest
target: 'aarch64-apple-darwin' target: 'aarch64-apple-darwin'
build: yarn build --target=aarch64-apple-darwin build: |
yarn build --target=aarch64-apple-darwin
strip -x *.node
- host: ubuntu-latest - host: ubuntu-latest
target: 'aarch64-unknown-linux-gnu' target: 'aarch64-unknown-linux-gnu'
setup: | setup: |
@ -159,7 +163,7 @@ jobs:
path: \${{ env.APP_NAME }}.*.node path: \${{ env.APP_NAME }}.*.node
build-freebsd: build-freebsd:
runs-on: macos-latest runs-on: macos-10.15
name: Build FreeBSD name: Build FreeBSD
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -176,7 +180,9 @@ jobs:
usesh: true usesh: true
mem: 3000 mem: 3000
prepare: | prepare: |
pkg install -y curl node yarn npm python2 pkg install -y curl node14 python2
curl -qL https://www.npmjs.com/install.sh | sh
npm install -g yarn
curl https://sh.rustup.rs -sSf --output rustup.sh curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable sh rustup.sh -y --profile minimal --default-toolchain stable
export PATH="/usr/local/cargo/bin:$PATH" export PATH="/usr/local/cargo/bin:$PATH"
@ -357,20 +363,24 @@ jobs:
run: ls -R . run: ls -R .
shell: bash shell: bash
- name: Setup and run tests - name: Cache NPM dependencies
uses: docker://multiarch/ubuntu-core:arm64-focal uses: actions/cache@v2
with: with:
args: > path: node_modules
sh -c " key: npm-cache-test-linux-aarch64-gnu-\${{ matrix.node }}-\${{ hashFiles('yarn.lock') }}
apt-get update && \\
apt-get install -y ca-certificates gnupg2 curl apt-transport-https && \\ - name: Install dependencies
curl -sL https://deb.nodesource.com/setup_\${{ matrix.node }}.x | bash - && \\ run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
apt-get install -y nodejs && \\
npm install -g yarn && \\ - name: Setup and run tests
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \\ uses: addnab/docker-run-action@v3
yarn test && \\ with:
image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-\${{ matrix.node }}
options: -v \${{ github.workspace }}:/build -w /build
run: |
yarn test
ls -la ls -la
"
test-linux-aarch64-musl-binding: test-linux-aarch64-musl-binding:
name: Test bindings on aarch64-unknown-linux-musl - node@\${{ matrix.node }} name: Test bindings on aarch64-unknown-linux-musl - node@\${{ matrix.node }}
needs: needs:
@ -393,16 +403,24 @@ jobs:
run: ls -R . run: ls -R .
shell: bash shell: bash
- name: Setup and run tests - name: Cache NPM dependencies
uses: docker://multiarch/alpine:aarch64-latest-stable uses: actions/cache@v2
with: with:
args: > path: node_modules
sh -c " key: npm-cache-test-linux-aarch64-musl-\${{ matrix.node }}-\${{ hashFiles('yarn.lock') }}
apk add nodejs npm && \\
npm install -g yarn && \\ - name: Install dependencies
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \\ run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
npm test
" - name: Setup and run tests
uses: addnab/docker-run-action@v3
with:
image: multiarch/alpine:aarch64-latest-stable
options: -v \${{ github.workspace }}:/build -w /build
run: |
apk add nodejs npm yarn
yarn test
test-linux-arm-gnueabihf-binding: test-linux-arm-gnueabihf-binding:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@\${{ matrix.node }} name: Test bindings on armv7-unknown-linux-gnueabihf - node@\${{ matrix.node }}
needs: needs:
@ -428,20 +446,24 @@ jobs:
run: ls -R . run: ls -R .
shell: bash shell: bash
- name: Setup and run tests - name: Cache NPM dependencies
uses: docker://multiarch/ubuntu-core:armhf-focal uses: actions/cache@v2
with: with:
args: > path: node_modules
sh -c " key: npm-cache-test-linux-arm-gnueabihf-\${{ matrix.node }}-\${{ hashFiles('yarn.lock') }}
apt-get update && \\
apt-get install -y ca-certificates gnupg2 curl apt-transport-https && \\ - name: Install dependencies
curl -sL https://deb.nodesource.com/setup_\${{ matrix.node }}.x | bash - && \\ run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
apt-get install -y nodejs && \\
npm install -g yarn && \\ - name: Setup and run tests
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \\ uses: addnab/docker-run-action@v3
yarn test && \\ with:
image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-\${{ matrix.node }}
options: -v \${{ github.workspace }}:/build -w /build
run: |
yarn test
ls -la ls -la
"
publish: publish:
name: Publish name: Publish
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -81,6 +81,8 @@ export const createGithubActionsCIYml = (
requiredSteps.push(TEST_LINUX_ARM_GNUEABIHF) requiredSteps.push(TEST_LINUX_ARM_GNUEABIHF)
} }
fullTemplate.jobs.publish.needs = requiredSteps
return dump(fullTemplate, { return dump(fullTemplate, {
lineWidth: 1000, lineWidth: 1000,
}) })