Merge pull request #6 from planet-a-ventures/joscha/avsc-6x #51
This file contains 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: "Test & Deploy" | |
on: [push, pull_request] | |
env: | |
DIRENV_WARN_TIMEOUT: 5m | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
avsc: [5.7.x, 6.0.0-alpha.14] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v12 | |
- uses: DeterminateSystems/magic-nix-cache-action@v7 | |
- name: Check Nix flake Nixpkgs inputs | |
uses: DeterminateSystems/flake-checker-action@main | |
- run: nix flake check --no-build | |
- name: Install direnv with Nix | |
uses: aldoborrero/direnv-nix-action@v2 | |
with: | |
use_nix_profile: true | |
- name: Pre-commit checks | |
run: pre-commit run --all-files | |
- name: npm install | |
run: npm ci | |
- name: Install avsc | |
run: npm install --no-save avsc@${{ matrix.avsc }} | |
- name: Test | |
run: npm run test:coverage | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ matrix.avsc }}.zip | |
path: coverage/ | |
npm: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v12 | |
- uses: DeterminateSystems/magic-nix-cache-action@v7 | |
- name: Get tag version | |
if: startsWith(github.ref, 'refs/tags/') | |
id: get_tag_version | |
run: echo TAG_VERSION=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT | |
- name: Set package version | |
if: startsWith(github.ref, 'refs/tags/') | |
run: npm version ${{steps.get_tag_version.outputs.TAG_VERSION}} | |
- name: npm install | |
run: nix develop --command npm install | |
- name: Build | |
run: npm run build | |
- name: Pack | |
run: nix develop --command npm pack | |
- name: Archive generated npm package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: npm-package.zip | |
path: planet-a-avsc-zstandard-codec-*.tgz | |
- name: Publish to npm | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: nix develop --ignore-environment --keep NODE_AUTH_TOKEN --command bash -c 'npm publish planet-a-avsc-zstandard-codec-*.tgz' |