Skip to content

Commit

Permalink
chore - ci
Browse files Browse the repository at this point in the history
  • Loading branch information
rumblefrog committed Jun 20, 2021
1 parent e2c62ab commit 30a71c9
Show file tree
Hide file tree
Showing 9 changed files with 781 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[build]
rustflags = ["-Ctarget-cpu=native"]
rustflags = ["-Ctarget-cpu=native"]
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 4
insert_final_newline = true

[*.yml]
indent_size = 2
217 changes: 217 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
name: CI

on:
push:
paths:
- 'release_build.txt'

jobs:
linux:
name: Build Linux

env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

strategy:
matrix:
node-version: [ 14.x ]
target:
- x86_64-unknown-linux-gnu
include:
- target: x86_64-unknown-linux-gnu
architecture: x64

runs-on: ubuntu-latest

timeout-minutes: 30

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: cargo-registry-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Cache cargo bin
uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: cargo-bin-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: cargo-build-target-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Install latest Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn --ignore-scripts

- name: Build
run: yarn build --target=${{ matrix.target }}

- name: Test
run: yarn test

- name: Publish
run: |
yarn package --target_arch=${{ matrix.architecture }}
yarn upload-binary
windows:
name: Build Windows

env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

strategy:
matrix:
node-version: [ 14.x ]
target:
- x86_64-pc-windows-msvc
include:
- target: x86_64-pc-windows-msvc
architecture: x64

runs-on: windows-latest

timeout-minutes: 30

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: cargo-registry-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Cache cargo bin
uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: cargo-bin-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: cargo-build-target-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Install latest Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn --ignore-scripts

- name: Build
run: yarn build --target=${{ matrix.target }}

- name: Test
run: yarn test

- name: Publish
run: |
yarn package --target_arch=${{ matrix.architecture }}
yarn upload-binary
macos:
name: Build MacOS

env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SDKROOT: "/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk"

strategy:
matrix:
node-version: [ 14.x ]
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
include:
- target: x86_64-apple-darwin
architecture: x64
- target: aarch64-apple-darwin
architecture: arm

runs-on: macos-latest

timeout-minutes: 30

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: cargo-registry-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Cache cargo bin
uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: cargo-bin-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: cargo-build-target-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: Install latest Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn --ignore-scripts

- name: Build
run: yarn build --target=${{ matrix.target }}

# Until GH action adds M1 runners, can't run aarch64 libs
- name: Test
if: ${{ matrix.architecture == 'x64' }}
run: yarn test

- name: Publish
run: |
yarn package --target_arch=${{ matrix.architecture }}
yarn upload-binary
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist

# Cargo artifact copy
*.node
build
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "rust-fetch"
version = "0.5.0"
version = "0.5.1"
authors = ["rumblefrog <[email protected]>"]
edition = "2018"
rust = "1.52"
rust = "1.52" # Requires nightly as of now

[lib]
crate-type = ["cdylib"]
Expand Down
26 changes: 24 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
{
"name": "rust-fetch",
"version": "0.5.0",
"version": "0.5.1",
"description": "Rust HTTP wrapper for JS",
"main": "dist/index.js",
"files": [
"dist",
"index.node"
],
"repository": {
"type": "git",
"url": "git+https://github.com/TextsHQ/rust-fetch.git"
},
"binary": {
"module_name": "index",
"host": "https://github.com/TextsHQ/rust-fetch/releases/download/",
"remote_path": "v{version}",
"module_path": ".",
"package_name": "rust-fetch-{node_abi}-{platform}-{arch}.tar.gz",
"pkg_path": "."
},
"scripts": {
"build": "tsc && cargo-cp-artifact -nc index.node -- cargo build --release --message-format=json-render-diagnostics",
"install": "yarn run build",
"install": "node-pre-gyp install --fallback-to-build=false",
"package": "node-pre-gyp package",
"upload-binary": "node-pre-gyp-github publish",
"test": "jest"
},
"devDependencies": {
Expand All @@ -14,7 +32,11 @@
"cargo-cp-artifact": "^0.1",
"form-data": "^4.0.0",
"jest": "^27.0.4",
"node-pre-gyp-github": "https://github.com/rumblefrog/node-pre-gyp-github.git",
"tough-cookie": "^4.0.0",
"typescript": "^4.3.2"
},
"dependencies": {
"node-pre-gyp": "^0.17.0"
}
}
1 change: 1 addition & 0 deletions release_build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.5.1
Loading

0 comments on commit 30a71c9

Please sign in to comment.