name: CI
on:
push:
branches: ["creation"]
pull_request:
branches: ["creation"]
release:
types: [created]
permissions:
contents: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v2.x
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install LLVM (Clang)
run: |
sudo apt-get update
sudo apt-get install -y llvm clang
- name: Build WASM
run: deno task build
env:
CC: clang
- name: Build Browser WASM
run: deno task build:inline
env:
CC: clang
- name: Run Tests
run: deno task test
- name: Run Benchmarks
run: deno task bench
- name: Build NPM Package
run: deno task build:npm
- name: Check Version Consistency
if: github.event_name == 'release' && github.event.action == 'created'
run: deno task check-version
- name: Verify Artifacts
run: |
test -f lib/panchangam.js
test -f lib/browser/panchangam.js
test -f npm/package.json
test -f npm/panchangam.js
- name: Upload lib artifacts
if: github.event_name == 'release' && github.event.action == 'created'
uses: actions/upload-artifact@v4
with:
name: lib-artifacts
path: lib/
- name: Upload npm artifacts
if: github.event_name == 'release' && github.event.action == 'created'
uses: actions/upload-artifact@v4
with:
name: npm-artifacts
path: npm/
publish-crates:
name: Publish to Crates.io
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v2.x
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Check Version Consistency
run: deno task check-version ${{ github.ref_name }}
- name: Publish to Crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish-jsr:
name: Publish to JSR
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
id-token: write
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v2.x
- name: Check Version Consistency
run: deno task check-version ${{ github.ref_name }}
- name: Download lib artifacts
uses: actions/download-artifact@v4
with:
name: lib-artifacts
path: lib/
- name: Publish to JSR
run: deno publish
publish-npm:
name: Publish to NPM
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
needs: build
steps:
- name: Download npm artifacts
uses: actions/download-artifact@v4
with:
name: npm-artifacts
path: npm/
- name: Publish to NPM
run: |
cd npm
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
npm publish --access public