Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Aug 4, 2023
0 parents commit a902e02
Show file tree
Hide file tree
Showing 279 changed files with 5,534,356 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
coverage = "run -p hdx_coverage --release --"
benchmark = "run -p hdx_benchmark --release --"
lint = "clippy --workspace --all-targets --all-features"
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab

[*.y{a,}ml]
indent_style = space
indent_size = 2
86 changes: 86 additions & 0 deletions .github/actions/rustup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copied from https://github.com/web-infra-dev/oxc/blob/main/.github/actions/rustup/action.yml

name: Rustup

description: Install Rust with minimal profile and additional components

inputs:
# See https://rust-lang.github.io/rustup/concepts/components.html
clippy:
default: false
required: false
type: boolean
fmt:
default: false
required: false
type: boolean
docs:
default: false
required: false
type: boolean
restore-cache:
default: true
required: false
type: boolean
save-cache:
default: false
required: false
type: boolean
shared-key:
default: "warm"
required: false
type: string

runs:
using: composite
steps:
- name: Print Inputs
shell: bash
run: |
echo 'clippy: ${{ inputs.clippy }}'
echo 'fmt: ${{ inputs.fmt }}'
echo 'docs: ${{ inputs.docs }}'
echo 'restore-cache: ${{ inputs.restore-cache }}'
echo 'save-cache: ${{ inputs.save-cache }}'
- name: Remove `profile` line on MacOS
shell: bash
if: runner.os == 'macOS'
run: sed -i '' '/profile/d' rust-toolchain.toml

- name: Remove `profile` line on non-MacOS
shell: bash
if: runner.os != 'macOS'
run: sed -i '/profile/d' rust-toolchain.toml

- name: Set minimal
shell: bash
run: rustup set profile minimal

- name: Add Clippy
shell: bash
if: ${{ inputs.clippy == 'true' }}
run: rustup component add clippy

- name: Add Rustfmt
shell: bash
if: ${{ inputs.fmt == 'true' }}
run: rustup component add rustfmt

- name: Add docs
shell: bash
if: ${{ inputs.docs == 'true' }}
run: rustup component add rust-docs

- name: Install
shell: bash
run: |
rustup show
git restore .
- name: Cache on ${{ github.ref_name }}
uses: Swatinem/rust-cache@v2
if: ${{ inputs.restore-cache == 'true' }}
with:
shared-key: ${{ inputs.shared-key }}
save-if: ${{ inputs.save-cache == 'true' }}
1 change: 1 addition & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [keithamus]
39 changes: 39 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/configure-pages@v3
- uses: ./.github/actions/rustup
with:
save-cache: ${{ github.ref_name == 'main' }}
shared-key: "wasm"
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache-dependency-path: ./website/package.json
cache: "npm"
- run: npm i --production=false
working-directory: ./website
env:
NODE_ENV: production
- uses: actions/upload-pages-artifact@v2
with:
path: "website/_site"
- id: deployment
uses: actions/deploy-pages@v2
120 changes: 120 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# mostly copied from https://raw.githubusercontent.com/web-infra-dev/oxc/main/.github/workflows/release_cli.yml
name: release
on:
push:
branches: ["main"]
release:
types: [created]
workflow_dispatch:
concurrency:
group: "release"
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64

- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64

- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
code-target: linux-x64

- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
code-target: linux-arm64

- os: macos-latest
target: x86_64-apple-darwin
code-target: darwin-x64

- os: macos-latest
target: aarch64-apple-darwin
code-target: darwin-arm64

name: Package ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- run: rustup target add ${{ matrix.target }}
- name: Install arm64 toolchain
if: matrix.code-target == 'linux-arm64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: release-${{ matrix.target }}
- name: Build Binary
# strip debug symbols from std, see https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort
run: cargo build --release --target ${{ matrix.target }} -p hdx
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

# The binary is zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss
- name: Archive Binary
if: runner.os == 'Windows'
shell: bash
run: |
BIN_NAME=hdx-${{ matrix.code-target }}
mv target/${{ matrix.target }}/release/hdx.exe $BIN_NAME.exe
7z a $BIN_NAME.zip $BIN_NAME.exe
# The binary is zipped to fix permission loss https://github.com/actions/upload-artifact#permission-loss
- name: Archive Binary
if: runner.os != 'Windows'
run: |
BIN_NAME=hdx-${{ matrix.code-target }}
mv target/${{ matrix.target }}/release/hdx $BIN_NAME
tar czf $BIN_NAME.tar.gz $BIN_NAME
- name: Upload Binary
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: binaries
path: |
*.zip
*.tar.gz
deploy:
env:
TAG_NAME: ${{ github.event.release.tag_name || format('0.0.0-canary.{0}', github.SHA) }}
DIST_TAG: ${{ github.event.release.tag_name && 'latest' || 'canary' }}
runs-on: ubuntu-latest
needs:
- build
steps:
- run: echo "TAG_NAME=$TAG_NAME"; echo "DIST_TAG=$DIST_TAG"
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache-dependency-path: ./website/package.json
cache: "npm"
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: binaries
- name: Unzip
uses: montudor/action-zip@v1
with:
args: unzip -qq *.zip -d packages/hdx/bin/
- name: Untar
run: ls *.gz | xargs -i tar xf {} -C packages/hdx/bin
- run: tree
- run: npm i
working-directory: ./packages/hdx
- run: npm version ${TAG_NAME} --no-git-tag-version
working-directory: ./packages/hdx
- run: npm pub --provenance --dist-tag=$DIST_TAG --access=public
working-directory: ./packages/hdx
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
target/
node_modules/
/*.js
/*.jsx
/*.ts
/*.tsx
*~
website/_site
*.wasm
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "tasks/coverage/css-tokenizer-tests"]
path = tasks/coverage/css-tokenizer-tests
url = https://github.com/romainmenke/css-tokenizer-tests
[submodule "tasks/coverage/postcss-parser-tests"]
path = tasks/coverage/postcss-parser-tests
url = https://github.com/postcss/postcss-parser-tests
Loading

0 comments on commit a902e02

Please sign in to comment.