diff --git a/.github/semantic.yml b/.github/semantic.yml new file mode 100644 index 0000000..40b6927 --- /dev/null +++ b/.github/semantic.yml @@ -0,0 +1,5 @@ +# Always validate the PR title AND all the commits +titleAndCommits: true +# Allows use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns") +# this is only relevant when using commitsOnly: true (or titleAndCommits: true) +allowMergeCommits: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..30d33a9 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,52 @@ +name: fits/publish + +on: + push: + branches: + - main + +jobs: + ci: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [17] + + steps: + - name: Checkout ๐Ÿ›Ž + uses: actions/checkout@master + + # Setup .npmrc file to publish to GitHub Packages + - name: Setup node env ๐Ÿ— and .npmrc file to publish to GitHub Packages + uses: actions/setup-node@v2.1.2 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://npm.pkg.github.com' + # Defaults to the user or organization that owns the workflow file: + scope: '@observerly' + + - name: Cache node_modules ๐Ÿ“ฆ + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install project dependencies ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป + run: npm ci + + - name: Build the package ready for publishing + run: npm run build + + - uses: JS-DevTools/npm-publish@v1 + with: + registry: 'https://npm.pkg.github.com' + token: ${{ secrets.GITHUB_TOKEN }} + check-version: true + + - if: steps.publish.outputs.type != 'none' + run: | + echo "@observerly/polaris package version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..917cb41 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: fits/vitest + +on: + pull_request: + branches: + - main + +jobs: + unit: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node: [16, 17] + + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + - name: Checkout ๐Ÿ›Ž + uses: actions/checkout@master + + # Setup .npmrc file to publish to GitHub Packages + - name: Setup node env ๐Ÿ— and .npmrc file to publish to GitHub Packages + uses: actions/setup-node@v2.1.2 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://npm.pkg.github.com' + # Defaults to the user or organization that owns the workflow file: + scope: '@observerly' + + - name: Cache node_modules ๐Ÿ“ฆ + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install project dependencies ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป + run: npm ci + + - name: Run vitest tests ๐Ÿงช + run: npm run test