Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI/CD workflows and Correct Coverage #100

Merged
merged 19 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/.build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- run: |
sudo apt-get update
sudo apt-get install libstdc++-12-dev
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
kamiazya marked this conversation as resolved.
Show resolved Hide resolved
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- uses: actions/upload-artifact@v4
with:
name: web-csv-toolbox-wasm
path: |
web-csv-toolbox-wasm/**/*
!web-csv-toolbox-wasm/src
!web-csv-toolbox-wasm/target
!web-csv-toolbox-wasm/Cargo.toml
!web-csv-toolbox-wasm/Cargo.lock
!web-csv-toolbox-wasm/.gitignore
50 changes: 50 additions & 0 deletions .github/workflows/.check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Check Format and Lint
on:
workflow_call:

jobs:
biome:
name: Check with Biome
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Check
run: npx biome ci .
clippy_and_rustfmt:
name: Check with clippy and rustfmt
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- run: |
sudo apt-get update
sudo apt-get install libstdc++-12-dev
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
components: clippy,rustfmt
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Run Clippy
run: cargo clippy --manifest-path=./web-csv-toolbox-wasm/Cargo.toml --all-targets --all-features
env:
RUSTFLAGS: -D warnings
- name: Run Fmt
run: cargo fmt --manifest-path=./web-csv-toolbox-wasm/Cargo.toml --all -- --check
50 changes: 6 additions & 44 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,7 @@ jobs:
# Build the package and upload it as an artifact
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- run: |
sudo apt-get update
sudo apt-get install libstdc++-12-dev
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
uses: ./.github/workflows/.build.yaml
# Release the package to npm
release:
name: Release
Expand Down Expand Up @@ -129,7 +98,9 @@ jobs:
doc:
runs-on: ubuntu-latest
# if the release job was successful, run this job
needs: release
needs:
- build
- release
if: needs.release.outputs.published == 'true'
concurrency:
group: GitHub Pages
Expand All @@ -146,25 +117,16 @@ jobs:
- uses: pnpm/action-setup@v2
with:
version: 8
- run: |
sudo apt-get update
sudo apt-get install libstdc++-12-dev
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@v4
- name: Build
run: pnpm run build
run: pnpm build:js
- name: Build documentation
run: pnpm run doc
- name: Configure GitHub Pages
Expand Down
126 changes: 25 additions & 101 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,42 @@ on:

jobs:
build:
name: Build
uses: ./.github/workflows/.build.yaml
check:
name: Check
uses: ./.github/workflows/.check.yaml

coverage:
runs-on: ubuntu-latest
permissions:
contents: read
needs: build
steps:
- name: Checkout Repo
- name: Checkout
uses: actions/checkout@v4
- run: |
sudo apt-get update
sudo apt-get install libstdc++-12-dev
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js 20
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- uses: actions/download-artifact@v4
- name: Coverage
run: pnpm test:coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test_nodejs:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node-version: [18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
Expand All @@ -54,15 +51,8 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- uses: actions/download-artifact@v4
- run: pnpm test run

test_deno:
Expand All @@ -88,6 +78,7 @@ jobs:

test_linux_browser:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
Expand All @@ -96,16 +87,6 @@ jobs:
- firefox
steps:
- uses: actions/checkout@v3
- run: |
sudo apt-get update
sudo apt-get install libstdc++-12-dev
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: pnpm/action-setup@v2
with:
version: 8
Expand All @@ -115,10 +96,12 @@ jobs:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@v4
- run: npm test run -- --browser.name=${{ matrix.browsers }} --browser.headless

test_macos_browser:
runs-on: macos-latest
needs: build
strategy:
fail-fast: false
matrix:
Expand All @@ -130,13 +113,6 @@ jobs:
# - safari
steps:
- uses: actions/checkout@v3
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: pnpm/action-setup@v2
with:
version: 8
Expand All @@ -148,10 +124,12 @@ jobs:
# - if: matrix.browsers == 'safari'
# run: sudo safaridriver --enable
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@v4
- run: pnpm test run -- --browser.name=${{ matrix.browsers }} --browser.headless

test_windows_browser:
runs-on: windows-latest
needs: build
strategy:
fail-fast: false
matrix:
Expand All @@ -161,13 +139,6 @@ jobs:
- edge
steps:
- uses: actions/checkout@v3
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: pnpm/action-setup@v2
with:
version: 8
Expand All @@ -176,53 +147,6 @@ jobs:
with:
node-version: 20
cache: pnpm
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@v4
- run: pnpm test run -- --browser.name=${{ matrix.browsers }} --browser.headless

check_nodejs:
name: Check Node.js
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Check
run: npx biome ci .
check_rust:
name: Check Rust
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- run: |
sudo apt-get update
sudo apt-get install libstdc++-12-dev
- name: Install latest
uses: moonrepo/setup-rust@v1
with:
targets: wasm32-unknown-unknown
channel: nightly
components: clippy,rustfmt
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Run Clippy
run: cargo clippy --manifest-path=./web-csv-toolbox-wasm/Cargo.toml --all-targets --all-features
env:
RUSTFLAGS: -D warnings
- name: Run Fmt
run: cargo fmt --manifest-path=./web-csv-toolbox-wasm/Cargo.toml --all -- --check
Loading
Loading