forked from linagora/ToM-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jordy Cabannes
committed
Jan 9, 2024
1 parent
6faf6e1
commit 1374b9e
Showing
6 changed files
with
160 additions
and
87 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node LTS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build packages | ||
run: npm run build | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Add hosts for integration tests | ||
run: sudo echo "127.0.0.1 localhost auth.example.com matrix.example.com matrix1.example.com matrix2.example.com matrix3.example.com federation.example.com" | sudo tee -a /etc/hosts | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node LTS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install playwright test browsers | ||
run: npx playwright install | ||
- name: Run all tests | ||
run: npm test | ||
|
||
publish-docker: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get all src files that have changed | ||
id: changed-files | ||
uses: tj-actions/changed-files@v41 | ||
with: | ||
files: ${{ github.workspace }}/packages/matrix-invite/**/* | ||
- name: Build and publish matrix-invite docker image | ||
if: steps.changed-files.outputs.test_any_changed == 'true' | ||
uses: philips-software/[email protected] | ||
with: | ||
base-dir: "${{ github.workspace }}/packages/matrix-invite/" | ||
dockerfile: "${{ github.workspace }}/packages/matrix-invite/Dockerfile" | ||
image-name: "twake-matrix-invite" | ||
tags: "latest" | ||
env: | ||
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USER }} | ||
REGISTRY_TOKEN: "${{ secrets.DOCKERHUB_PASSWORD }}" | ||
DOCKER_ORGANIZATION: twaketech | ||
|
||
update-doc: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node LTS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Generate Swagger documentation | ||
run: npm run doc | ||
- name: Check if documentation files has changed | ||
id: changed-files | ||
uses: tj-actions/changed-files@v41 | ||
with: | ||
files: ${{ github.workspace }}/docs/openapi.json | ||
- name: Update documentation files | ||
if: steps.changed-files.outputs.test_any_changed == 'true' | ||
env: | ||
SPEC_TO_DISPLAY: "openapi.json" | ||
DISABLE_TRY_IT_OUT_JS_METHOD: "const DisableTryItOutPlugin = function() {return {statePlugins:{spec:{wrapSelectors:{allowTryItOutFor:() => () => false}}}}}" | ||
DISABLE_TRY_IT_OUT_PLUGIN: ", DisableTryItOutPlugin" | ||
run: | | ||
cp -rp node_modules/swagger-ui-dist/* ${{ github.workspace }}/docs | ||
sed -i "/window\.onload\s=\sfunction()\s{/a $DISABLE_TRY_IT_OUT_JS_METHOD" ${{ github.workspace }}/docs/swagger-initializer.js | ||
sed -i "s#https://petstore\.swagger\.io/v2/swagger\.json#$SPEC_TO_DISPLAY#g" ${{ github.workspace }}/docs/swagger-initializer.js | ||
sed -i "/SwaggerUIBundle\.plugins\.DownloadUrl/a $DISABLE_TRY_IT_OUT_PLUGIN" ${{ github.workspace }}/docs/swagger-initializer.js | ||
- name: Commit updated documentation files | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: ${{ github.workspace }}/docs | ||
message: 'chore: update documentation' |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
coverage/ | ||
dist/ | ||
documentation/ | ||
!documentation/swagger.cjs | ||
docs/* | ||
!docs/swagger.cjs | ||
node_modules/ | ||
packages/*/example/*.js* | ||
*.map | ||
.nx/ |
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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