Skip to content

Commit

Permalink
fix(cli): workflow file generated by new command
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Oct 27, 2021
1 parent c5cebec commit cbb71a9
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 36 deletions.
94 changes: 58 additions & 36 deletions cli/src/new/ci-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jobs:
settings:
- host: macos-latest
target: 'x86_64-apple-darwin'
build: yarn build
build: |
yarn build
strip -x *.node
- host: windows-latest
build: yarn build
target: 'x86_64-pc-windows-msvc'
Expand Down Expand Up @@ -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
- host: macos-latest
target: 'aarch64-apple-darwin'
build: yarn build --target=aarch64-apple-darwin
build: |
yarn build --target=aarch64-apple-darwin
strip -x *.node
- host: ubuntu-latest
target: 'aarch64-unknown-linux-gnu'
setup: |
Expand Down Expand Up @@ -159,7 +163,7 @@ jobs:
path: \${{ env.APP_NAME }}.*.node
build-freebsd:
runs-on: macos-latest
runs-on: macos-10.15
name: Build FreeBSD
steps:
- uses: actions/checkout@v2
Expand All @@ -176,7 +180,9 @@ jobs:
usesh: true
mem: 3000
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
sh rustup.sh -y --profile minimal --default-toolchain stable
export PATH="/usr/local/cargo/bin:$PATH"
Expand Down Expand Up @@ -357,20 +363,24 @@ jobs:
run: ls -R .
shell: bash
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: npm-cache-test-linux-aarch64-gnu-\${{ matrix.node }}-\${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Setup and run tests
uses: docker://multiarch/ubuntu-core:arm64-focal
uses: addnab/docker-run-action@v3
with:
args: >
sh -c "
apt-get update && \\
apt-get install -y ca-certificates gnupg2 curl apt-transport-https && \\
curl -sL https://deb.nodesource.com/setup_\${{ matrix.node }}.x | bash - && \\
apt-get install -y nodejs && \\
npm install -g yarn && \\
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \\
yarn test && \\
ls -la
"
image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-\${{ matrix.node }}
options: -v \${{ github.workspace }}:/build -w /build
run: |
yarn test
ls -la
test-linux-aarch64-musl-binding:
name: Test bindings on aarch64-unknown-linux-musl - node@\${{ matrix.node }}
needs:
Expand All @@ -393,16 +403,24 @@ jobs:
run: ls -R .
shell: bash
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: npm-cache-test-linux-aarch64-musl-\${{ matrix.node }}-\${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Setup and run tests
uses: docker://multiarch/alpine:aarch64-latest-stable
uses: addnab/docker-run-action@v3
with:
args: >
sh -c "
apk add nodejs npm && \\
npm install -g yarn && \\
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \\
npm test
"
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:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@\${{ matrix.node }}
needs:
Expand All @@ -428,20 +446,24 @@ jobs:
run: ls -R .
shell: bash
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: npm-cache-test-linux-arm-gnueabihf-\${{ matrix.node }}-\${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Setup and run tests
uses: docker://multiarch/ubuntu-core:armhf-focal
uses: addnab/docker-run-action@v3
with:
args: >
sh -c "
apt-get update && \\
apt-get install -y ca-certificates gnupg2 curl apt-transport-https && \\
curl -sL https://deb.nodesource.com/setup_\${{ matrix.node }}.x | bash - && \\
apt-get install -y nodejs && \\
npm install -g yarn && \\
yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 && \\
yarn test && \\
ls -la
"
image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-\${{ matrix.node }}
options: -v \${{ github.workspace }}:/build -w /build
run: |
yarn test
ls -la
publish:
name: Publish
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions cli/src/new/ci-yml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export const createGithubActionsCIYml = (
requiredSteps.push(TEST_LINUX_ARM_GNUEABIHF)
}

fullTemplate.jobs.publish.needs = requiredSteps

return dump(fullTemplate, {
lineWidth: 1000,
})
Expand Down

0 comments on commit cbb71a9

Please sign in to comment.