Add input validation, Node.js support, and Docker test environment #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD | |
| on: | |
| push: | |
| branches: [main, master] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup tools with mise | |
| uses: jdx/mise-action@v2 | |
| with: | |
| install: true | |
| cache: true | |
| - name: Setup project | |
| run: just ci-setup | |
| - name: Run all checks | |
| run: just check | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup tools with mise | |
| uses: jdx/mise-action@v2 | |
| with: | |
| install: true | |
| cache: true | |
| - name: Setup project | |
| run: just ci-setup | |
| - name: Run unit tests | |
| run: just test-unit | |
| build-vendor: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux-x64 | |
| - os: ubuntu-latest | |
| platform: linux-arm64 | |
| - os: macos-latest | |
| platform: darwin-arm64 | |
| - os: macos-13 | |
| platform: darwin-x64 | |
| - os: windows-latest | |
| platform: win32-x64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup tools with mise | |
| uses: jdx/mise-action@v2 | |
| with: | |
| install: true | |
| cache: true | |
| - name: Build vendor bundle | |
| shell: bash | |
| run: just ci-build-vendor ${{ matrix.platform }} | |
| - name: Upload vendor artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vendor-${{ matrix.platform }} | |
| path: mlnative/_vendor/${{ matrix.platform }}/ | |
| retention-days: 1 | |
| build-package: | |
| needs: [test, build-vendor] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all vendor artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: mlnative/_vendor/ | |
| pattern: vendor-* | |
| merge-multiple: false | |
| - name: Organize vendor directories | |
| run: | | |
| for dir in mlnative/_vendor/vendor-*; do | |
| platform=$(basename "$dir" | sed 's/vendor-//') | |
| mv "$dir" "mlnative/_vendor/$platform" | |
| done | |
| - name: Setup tools with mise | |
| uses: jdx/mise-action@v2 | |
| with: | |
| install: true | |
| cache: true | |
| - name: Build package | |
| run: just ci-build | |
| - name: Upload package artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| retention-days: 5 | |
| publish-testpypi: | |
| needs: build-package | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/mlnative | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download package artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| publish-pypi: | |
| needs: [build-package, publish-testpypi] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/mlnative | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download package artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |