RS-31: Add changing labels #346
Workflow file for this run
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: ci | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "v*" | |
pull_request: | |
branches: [main] | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: npm i | |
- run: npm run fmt:check | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- format | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and export | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: ${{github.repository}}:latest | |
outputs: type=docker,dest=/tmp/image.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: image | |
path: /tmp/image.tar | |
run_tests: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
token: ["", "token"] | |
reductstore_version: ["main", "latest"] | |
license: ["", "/workdir/lic.key"] | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: image | |
path: /tmp/ | |
- name: Generate license | |
run: echo '${{secrets.LICENSE_KEY}}' > lic.key | |
- name: Run ReductStore | |
run: docker run -p 8383:8383 -v ${PWD}:/workdir | |
--env RS_API_TOKEN=${{matrix.token}} | |
--env RS_LOG_LEVEL=DEBUG | |
--env RS_LICENSE_PATH=${{matrix.license}} | |
-d reduct/store:${{ matrix.reductstore_version }} | |
- name: Load image with tests | |
run: | | |
docker load --input /tmp/image.tar | |
docker image ls -a | |
- name: Run tests | |
run: docker run --network=host | |
--env RS_API_TOKEN=${{ matrix.token }} | |
--env RS_LICENSE_PATH=${{matrix.license}} | |
${{github.repository}} npm test | |
run_examples: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
example: ["HelloWorld.js", "QuickStart.js", "Subscription.js"] | |
reductstore_version: ["main", "latest"] | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: image | |
path: /tmp/ | |
- name: Run ReductStore | |
run: docker run -p 8383:8383 -v ${PWD}/data:/data -d reduct/store:${{ matrix.reductstore_version }} | |
- name: Wait for ReductStore | |
run: sleep 3 | |
- name: Load image with tests | |
run: | | |
docker load --input /tmp/image.tar | |
docker image ls -a | |
- name: Run example | |
run: docker run --network=host ${{github.repository}} node examples/${{matrix.example}} | |
lint: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: image | |
path: /tmp/ | |
- name: Load image with tests | |
run: | | |
docker load --input /tmp/image.tar | |
docker image ls -a | |
- name: Run tests | |
run: docker run --network=host ${{github.repository}} npm run lint | |
publish: | |
needs: [run_tests, run_examples, lint] | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 17 | |
- run: npm i | |
- uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} |