1093 bug wrong docker files for library microservice #1018
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: Library microservice | |
on: | |
push: | |
paths: | |
- 'servers/lib/**' | |
pull_request: | |
paths: | |
- 'servers/lib/**' | |
workflow_dispatch: | |
env: | |
NODE_VERSION: 20 | |
HTTP_PORT: 4002 | |
LIBMS_CONFIG_PATH: test/libms.test.yaml | |
jobs: | |
test-lib-ms: | |
name: Test library microservice | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: servers/lib | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: "yarn" | |
cache-dependency-path: "**/yarn.lock" | |
- name: Install pm2 and jest | |
run: | | |
npm install -g pm2 | |
npm install -g jest | |
- name: Run the linting checks and formatting | |
run: | | |
yarn install | |
yarn syntax | |
yarn format | |
- name: Build the lib microservice | |
run: | | |
yarn build | |
- name: Run all tests | |
run: | | |
yarn build | |
yarn test:all | |
- name: Update configuration | |
env: | |
LIBMS_LOCAL_PATH: ${{ github.workspace }}/files | |
LIBMS_PORT: ${{ env.HTTP_PORT }} | |
run: | | |
node test/update-config.js | |
- name: Start http mode | |
env: | |
LIBMS_CONFIG_PATH: ${{env.LIBMS_CONFIG_PATH}} | |
run: | | |
yarn build | |
yarn start:pm2 | |
- name: Check server is running (Windows) | |
if: runner.os == 'Windows' | |
env: | |
PORT: ${{ env.HTTP_PORT }} | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_seconds: 10 | |
max_attempts: 4 | |
command: "Invoke-WebRequest -Uri http://localhost:${{ env.PORT }}/lib/files -Method Head -UseBasicParsing" | |
- name: Check server is running (Linux) | |
if: runner.os != 'Windows' | |
env: | |
PORT: ${{ env.HTTP_PORT }} | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_seconds: 10 | |
max_attempts: 4 | |
command: "curl -f -LI http://localhost:${{ env.PORT }}/lib/files" | |
- name: Run http test | |
env: | |
PORT: ${{ env.HTTP_PORT }} | |
LOCAL_PATH: ${{ github.workspace }}/files | |
MODE: local | |
LOG_LEVEL: debug | |
APOLLO_PATH: /lib | |
run: | | |
yarn test:http-github | |
- name: Stop http mode | |
run: | | |
yarn stop:pm2 | |
- name: Upload test coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: servers/lib/coverage/clover.xml | |
flags: lib-microservice-tests | |
get_version: | |
name: Get version and variables | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install jq | |
run: sudo apt-get install -y jq | |
- name: get version | |
id: get_version | |
run: | | |
version=`cat ./servers/lib/package.json | jq -r '.version'` | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "node-version=$NODE_VERSION" >> $GITHUB_OUTPUT | |
outputs: | |
version: ${{ steps.get_version.outputs.version }} | |
node-version: ${{ steps.get_version.outputs.node-version }} | |
publish-package-github: | |
if: | | |
(startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/heads/release-v')) | |
name: Publish to GitHub Packages | |
needs: [get_version,test-lib-ms] | |
uses: ./.github/workflows/publish-npm.yml | |
with: | |
node-version: ${{ needs.get_version.outputs.node-version }} | |
registry-url: 'https://npm.pkg.github.com/' | |
directory: servers/lib | |
package-name: ${{ vars.PACKAGE_NAME || '' }} | |
secrets: | |
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-package-npm: | |
if: | | |
(startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/heads/release-v')) | |
name: Publish to NPM | |
needs: [get_version,test-lib-ms] | |
uses: ./.github/workflows/publish-npm.yml | |
with: | |
node-version: ${{ needs.get_version.outputs.node-version }} | |
registry-url: 'https://registry.npmjs.org' | |
directory: servers/lib | |
package-name: ${{ vars.PACKAGE_NAME || '' }} | |
secrets: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN}} | |
publish-docker-image-ghcr: | |
if: | | |
github.event_name == 'push' && | |
(startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/heads/release-v')) | |
name: Publish Docker image (GHCR) | |
needs: [get_version, test-lib-ms] | |
uses: ./.github/workflows/docker-ghcr.yml | |
with: | |
image-name: libms | |
version: ${{ needs.get_version.outputs.version }} | |
dockerfile: libms.dockerfile | |
secrets: inherit | |
publish-docker-image-dockerhub: | |
if: | | |
github.event_name == 'push' && | |
(startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/heads/release-v')) | |
name: Publish Docker image (DockerHub) | |
needs: [get_version, test-lib-ms] | |
uses: ./.github/workflows/docker-dockerhub.yml | |
with: | |
image-name: libms | |
version: ${{ needs.get_version.outputs.version }} | |
dockerfile: libms.dockerfile | |
readme-file: servers/lib/DOCKER.md | |
secrets: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_SCOPE: ${{ secrets.DOCKERHUB_SCOPE }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} |