chore: build codes in node:10-alpine
This commit is contained in:
parent
2bbec96802
commit
42528c41dd
3 changed files with 29 additions and 19 deletions
4
.github/workflows/docker.yaml
vendored
4
.github/workflows/docker.yaml
vendored
|
@ -22,8 +22,8 @@ jobs:
|
||||||
|
|
||||||
- name: Build docker image
|
- name: Build docker image
|
||||||
run: |
|
run: |
|
||||||
docker build . -f alpine.Dockerfile --pull --no-cache -t docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts
|
docker build . -f alpine.Dockerfile --pull --no-cache -t docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
|
||||||
|
|
||||||
- name: Push docker image
|
- name: Push docker image
|
||||||
run: |
|
run: |
|
||||||
docker push docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts
|
docker push docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
|
||||||
|
|
28
.github/workflows/linux-musl.yaml
vendored
28
.github/workflows/linux-musl.yaml
vendored
|
@ -10,12 +10,24 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: stable - x86_64-unknown-linux-musl - node@14
|
name: stable - x86_64-unknown-linux-musl - node@10
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: stable-${{ matrix.os }}-node-alpine-@10-${{ matrix.node }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo index
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/git
|
||||||
|
key: stable-${{ matrix.os }}-node-alpine-@10-${{ matrix.node }}-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Log in to registry
|
- name: Log in to registry
|
||||||
run: |
|
run: |
|
||||||
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
|
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
|
||||||
|
@ -26,24 +38,24 @@ jobs:
|
||||||
|
|
||||||
- name: Pull docker image
|
- name: Pull docker image
|
||||||
run: |
|
run: |
|
||||||
docker pull docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts
|
docker pull docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine
|
||||||
docker tag docker.pkg.github.com/napi-rs/napi-rs/rust-nodejs-alpine:lts builder
|
docker tag docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:10-alpine builder
|
||||||
|
|
||||||
- name: 'Install node dependencies'
|
- name: 'Install node dependencies'
|
||||||
run: docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder yarn
|
run: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn
|
||||||
|
|
||||||
- name: 'Install swc musl'
|
- name: 'Install swc musl'
|
||||||
run: docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder yarn add @swc/core-linux-musl --dev
|
run: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn add @swc/core-linux-musl --dev
|
||||||
|
|
||||||
- name: 'Build TypeScript'
|
- name: 'Build TypeScript'
|
||||||
run: docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder yarn build
|
run: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn build
|
||||||
|
|
||||||
- name: Run check
|
- name: Run check
|
||||||
run: |
|
run: |
|
||||||
docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder cargo check -vvv
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder cargo check -vvv
|
||||||
|
|
||||||
- name: Unit test
|
- name: Unit test
|
||||||
run: |
|
run: |
|
||||||
docker run --rm -v $(pwd)/.cargo:/root/.cargo -v $(pwd):/napi-rs -w /napi-rs builder sh -c "yarn build:test && yarn test"
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder sh -c "yarn build:test && yarn test"
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
FROM rust:alpine
|
FROM node:10-alpine
|
||||||
|
|
||||||
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
ENV RUSTFLAGS="-C target-feature=-crt-static" \
|
||||||
|
PATH="/root/.cargo/bin:$PATH" \
|
||||||
|
CC="clang" \
|
||||||
|
CXX="clang++"
|
||||||
|
|
||||||
RUN sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories && \
|
RUN sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories && \
|
||||||
apk update && \
|
apk update && \
|
||||||
apk add nodejs yarn clang musl-dev llvm-dev curl && \
|
apk add rustup musl-dev build-base && \
|
||||||
export NODE_VERSION=$(node -e "console.log(process.version)") && \
|
rustup-init -y
|
||||||
curl -fsSLO $(node -e "console.log(process.release.headersUrl)") && \
|
|
||||||
tar -xf "node-$NODE_VERSION-headers.tar.gz" && \
|
|
||||||
mv "node-$NODE_VERSION/include/node" include && \
|
|
||||||
rm -rf "node-$NODE_VERSION" && \
|
|
||||||
rm "node-$NODE_VERSION-headers.tar.gz"
|
|
||||||
|
|
Loading…
Reference in a new issue