Skip to content

Commit

Permalink
add pc ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatka committed Nov 7, 2023
1 parent 695ebdc commit 81fe1c4
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 8 deletions.
102 changes: 95 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ jobs:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
steps:
- name: Print current dir 1
run: pwd
- uses: actions/checkout@v2
with:
ref: ${{ github.event.release.tag_name }}
Expand All @@ -92,13 +90,9 @@ jobs:
with:
node-version: ${{ matrix.node_version }}
registry-url: 'https://registry.npmjs.org'
- name: Print current dir 1
run: pwd
- name: Install modules
working-directory: ./
run: |
pwd
pnpm install
run: pnpm install
- name: Tweak package.json
working-directory: ./
# This will update the package version to tag version. So artifacts uploaded to Github release will be named correctly.
Expand Down Expand Up @@ -238,6 +232,100 @@ jobs:
cargo --version
rustup --version
- name: Build native
working-directory: ./
run: |
pnpm run release-native
env:
RUST_LOG: debug
RUST_BACKTRACE: 1
- name: Package the asset
working-directory: ./
run: npx node-pre-gyp package
- name: Upload to Github releases
working-directory: ./
shell: bash
run: |
git config --global --add safe.directory '*'
gh release upload ${{ env.RELEASE_VERSION }} "$(find ./build -name *.tar.gz)" --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

nodejs-github-native:
name: nodejs-${{ matrix.node_version }}-${{ matrix.system.target }}-${{ matrix.system.os }}
runs-on: ${{ matrix.system.os }}
strategy:
fail-fast: false
matrix:
node_version:
- 16
- 18
system:
- os: macos-11
target: x86_64-apple-darwin
- os: windows-2022
target: x86_64-pc-windows-msvc
# Would like to have aarch64 support, but actions does not provide these yet.
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.release.tag_name }}
- name: Set release version
# Set release version in all three os, the commented run should suffice for linux and mac.
run: python3 -c "import os; tag = os.environ['GITHUB_REF'].split('/')[-1]; f = open(os.environ['GITHUB_ENV'], 'a'); f.write('RELEASE_VERSION='+tag); f.close();"
# run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
registry-url: 'https://registry.npmjs.org'
- name: Install pnpm
working-directory: ./
run: npm i -g pnpm
- name: Install modules
working-directory: ./
run: pnpm install
- name: Tweak package.json
working-directory: ./
# This will update the package version to tag version. So artifacts uploaded to Github release will be named correctly.
run: python -c "import os; import json; p = json.load(open('package.json')); p['version'] = os.environ['RELEASE_VERSION']; json.dump(p, open('package.json', 'w'), indent=2, ensure_ascii=False);"

- name: Cache toolchain
uses: actions/cache@v1
with:
path: ~/.cargo
key: ${{ runner.os }}-rustup
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}
- name: Install Rust
run: |
export HOME=/root
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
echo "$HOME/.rustup/bin" >> $GITHUB_PATH
- name: Install Rust toolchain
run: rustup default stable

- name: Check Rust
run: |
cargo --version
rustup --version
- name: Build native
working-directory: ./
run: |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shield3/banyan",
"version": "0.3.6",
"version": "0.3.7",
"description": "Banyan policy engine",
"main": "dist/index.js",
"scripts": {
Expand Down

0 comments on commit 81fe1c4

Please sign in to comment.