diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ac1eeff..ad5f811 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,35 +11,58 @@ env: RUST_LOG: "off" jobs: - publish-npm: - if: startsWith(github.ref, 'refs/tags/v') + wasm-build: + name: Wasm build runs-on: ubuntu-latest - permissions: - id-token: write + strategy: + matrix: + crate: ["biome_fmt", "web_fmt"] steps: - uses: actions/checkout@v4 - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: Build wasm + - name: Build ${{matrix.crate}} wasm run: | - ./crates/biome_fmt/scripts/build.sh - ./crates/web_fmt/scripts/build.sh + ./crates/${{ matrix.crate }}/scripts/build.sh + + - name: Package ${{matrix.crate}} + working-directory: crates/${{matrix.crate}}/pkg + run: npm pack + + - name: Upload ${{matrix.crate}} + uses: actions/upload-artifact@v4 + with: + name: ${{matrix.crate}} + path: | + crates/${{matrix.crate}}/pkg + # To keep the pkg directory structure + crates/${{matrix.crate}}/README.md + + publish-npm: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + id-token: write + strategy: + matrix: + crate: ["biome_fmt", "web_fmt"] + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: ${{matrix.crate}} + path: crates/${{matrix.crate}} - uses: actions/setup-node@v4 with: node-version-file: ".node-version" registry-url: "https://registry.npmjs.org" - - name: Publish biome_fmt - working-directory: crates/biome_fmt/pkg - run: npm publish --provenance - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Publish web_fmt - working-directory: crates/web_fmt/pkg + - name: Publish ${{matrix.crate}} + working-directory: crates/${{matrix.crate}}/pkg run: npm publish --provenance env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -49,30 +72,24 @@ jobs: runs-on: ubuntu-latest permissions: packages: write + strategy: + matrix: + crate: ["biome_fmt", "web_fmt"] steps: - uses: actions/checkout@v4 - - name: Install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: Build wasm - run: | - ./crates/biome_fmt/scripts/build.sh - ./crates/web_fmt/scripts/build.sh + - uses: actions/download-artifact@v4 + with: + name: ${{matrix.crate}} + path: crates/${{matrix.crate}} - uses: actions/setup-node@v4 with: node-version-file: ".node-version" registry-url: "https://npm.pkg.github.com" - - name: Publish biome_fmt - working-directory: crates/biome_fmt/pkg - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish web_fmt - working-directory: crates/web_fmt/pkg + - name: Publish ${{matrix.crate}} + working-directory: crates/${{matrix.crate}}/pkg run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -82,23 +99,19 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + strategy: + matrix: + crate: ["biome_fmt", "web_fmt"] steps: - uses: actions/checkout@v4 - - name: Install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: Build wasm - run: | - ./crates/biome_fmt/scripts/build.sh - ./crates/web_fmt/scripts/build.sh - - - name: Package biome_fmt - working-directory: crates/biome_fmt/pkg - run: npm pack + - uses: actions/download-artifact@v4 + with: + name: ${{matrix.crate}} + path: crates/${{matrix.crate}} - - name: Package web_fmt - working-directory: crates/web_fmt/pkg + - name: Package ${{matrix.crate}} + working-directory: crates/${{matrix.crate}}/pkg run: npm pack - name: Release @@ -106,4 +119,4 @@ jobs: with: files: | crates/*/pkg/*.tgz - crates/*/pkg/*.wasm \ No newline at end of file + crates/*/pkg/*.wasm diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4fd77ab..8a2370f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,11 @@ name: Test -on: [push, pull_request] +on: + push: + branches: + - "*" + pull_request: + types: ["opened", "reopened", "synchronize"] env: CARGO_INCREMENTAL: 0 @@ -34,31 +39,31 @@ jobs: wasm-build: name: Wasm build runs-on: ubuntu-latest + strategy: + matrix: + crate: ["biome_fmt", "web_fmt"] steps: - uses: actions/checkout@v4 - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: Build wasm + - name: Build ${{matrix.crate}} wasm run: | - ./crates/biome_fmt/scripts/build.sh - ./crates/web_fmt/scripts/build.sh + ./crates/${{ matrix.crate }}/scripts/build.sh - - name: Package biome_fmt - working-directory: crates/biome_fmt/pkg + - name: Package ${{matrix.crate}} + working-directory: crates/${{matrix.crate}}/pkg run: npm pack - - name: Package web_fmt - working-directory: crates/web_fmt/pkg - run: npm pack - - - name: Upload + - name: Upload ${{matrix.crate}} uses: actions/upload-artifact@v4 with: + name: ${{matrix.crate}} path: | - crates/biome_fmt/pkg - crates/web_fmt/pkg + crates/${{matrix.crate}}/pkg + # To keep the pkg directory structure + crates/${{matrix.crate}}/README.md node-test: runs-on: ubuntu-latest @@ -67,7 +72,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - path: crates/ + path: crates - uses: actions/setup-node@v4 with: @@ -82,7 +87,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - path: crates/ + path: crates - uses: denoland/setup-deno@v1 with: @@ -97,7 +102,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - path: crates/ + path: crates - uses: oven-sh/setup-bun@v1 name: Install bun