diff --git a/.bundlemonrc b/.bundlemonrc new file mode 100644 index 000000000..7c4da94ef --- /dev/null +++ b/.bundlemonrc @@ -0,0 +1,27 @@ +{ + "baseDir": "./build", + "files": [ + { + "path": "app/store..js" + }, + { + "path": "app-store..min.css" + }, + { + "path": "vendors-store..min.css" + }, + { + "path": "intent-store..min.css" + }, + { + "path": "intent/store..js" + }, + { + "path": "services/installSuggestion/store.js" + }, + { + "path": "vendors/store..js" + } + ], + "reportOutput": ["github"] +} diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 000000000..7e00c45f2 --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,45 @@ +name: CI/CD + +on: + pull_request: + push: + branches: + - master + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + +env: + MATTERMOST_CHANNEL: '{"dev":"app-store","beta":"app-store,publication","stable":"app-store,publication"}' + MATTERMOST_HOOK_URL: ${{ secrets.MATTERMOST_HOOK_URL }} + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + BUNDLEMON_PROJECT_ID: ${{ secrets.BUNDLEMON_PROJECT_ID }} + +jobs: + build: + name: Build and publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Lint + run: yarn lint + - name: Test + run: yarn test + - name: Build + run: yarn build + - name: BundleMon + uses: lironer/bundlemon-action@v1 + - name: Set SSH for downcloud + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.DOWNCLOUD_SSH_KEY }} + - name: Publish + if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') + run: yarn run cozyPublish --yes diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index af670e574..000000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -language: node_js -node_js: - - '20' -dist: jammy -cache: - npm: false -branches: - only: - - master - # detect also tag like x.y.z or x.y.z-beta.n as travis consider them to be branches - - /^\d+\.\d+\.\d+(\-beta.\d+)?$/ -env: - global: - - MATTERMOST_CHANNEL='{"dev":"app-store","beta":"app-store,publication","stable":"app-store,publication"}' - - # to generate secure ENV VARS : travis encrypt MY_VAR=value -r cozy/cozy-store - # RUNDECK_TOKEN - - secure: 'UBXl3CoUb33AJ3mKcvZiUHpSppe/YcTLTB2MoiYPyDAlQjNNg4pDLywmPFwg/PmuigconEh29e8XHRHMW7WbdUTWwRKmBS1B6QDCbpXJSrJsupvHCa718Zm6UfMolyZ2t0wZGeabuTF6HJkV+teM2MkBX/baHawIQivUSk7gGLxx3Wa6HgzvCnJbPsVQI75wSlxsVmIX8GeykBN8ZN0drIDPhFJ+lHB5D2MPEJyU/N3DxetLzVtJe8D0PJWOSQ3xyCWEA5HK2gPpXzVni98v4ekEoRBayBGd/rmUVMHxp08vQyuKDv4c+N83vtb1eMmqOV86dkfyfvLGhyhOMzEPcmcTreUhQbwcIzonZPNe/HFfDIrwdaYiy+BIvFs9ETG0d0UW6wHqINBHuu0KOSkM085Sn4XMwJ+iXuuFm0/RwRqdl5SN3H2jnjY3ZIaF3a0cvSUB9b24yaz84ejXPAFKDM3QgJAOJkDQSlifCEbnZ6D7h4EEjIz7WMn7u6eWehZagi2nlLSRc3hQVPuVgCK0mAjqAia4CoGc5Gnf90dV+CLHPCYOnmgLBUfatb8eZej6KFNRf8+Uri6tYJJZfDXTf1O++1hIJJru2bxD1m8uTY4iObCC0HhVrxO+JrCo6rdAbadROuznFtnww/ByaIXmm1pyDuMG10kxlJlDLwhPQsA=' - # MATTERMOST_HOOK_URL - - secure: 'wQLxrFhwcA7/XKNBo8sQNfVKVithxwowDws8GKxHdTIS0RpILs+yXt9d4cb/QGYvtqvty+X2n9Mn3OjKUy4NaX3BcnDA4wITtDySzAa5DKhzJtyDy8LdHv77QAzJRkisQrKR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ItVC73x8iH9hiX6n1MjqFyVAfmyBoUAOKI4m83ijB+LyqbOLWpZg3LCD5LxbIRAqG/+a/AOBRl5gvH9z5+ZIJZD2JYBlkhnQL9rZ65Q2lLH5N8BbaC/85IZTEUb4zBV0qgO9suZepMM5TNmYKy7Ix70z+FgAEwGkLEEB2KbMya9ZoL+mu+ImffsSs2CIT9OJxNpT0yWwRnXUvI7VgT8bJuirMTWCVPDO5qmW7uKED0PFd7Q/7MnqWQhqoHAt4xa7lYQvKbfs8ISMbiWlLXyaqRT3hdrZnBJ89Vrotu5eu2ce5sCgS4FcKEAWZ0NwATqkJHMf23H88gD7VrIqYQpX/DM5vuw2rCAVcBcbdOI5CEyt8foF6Ib9aSNGd7whLLcTxue7x7vPj658nfzS8hiZQcBiyQvKiLy5lGfBQ7T7edilFWX91HfnO2dACWtZJfVw0DrXu8G6HKuJM77wwrMZanTXw82oWxiyCRn0EGgmYYBNFn5dj3Vzd/ZmM= -jobs: - include: - - name: "Lint" - script: yarn lint - - name: "Unit tests" - script: yarn test - - name: 'Build app' - before_install: - - if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then openssl aes-256-cbc -K $encrypted_e8e75da126d5_key -iv $encrypted_e8e75da126d5_iv -in deploy/id_rsa_downcloud_cozy-store.enc -out /tmp/id_rsa_downcloud_cozy-store -d; fi - - if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then eval "$(ssh-agent -s)"; fi - - if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then chmod 600 /tmp/id_rsa_downcloud_cozy-store; fi - - if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then ssh-add /tmp/id_rsa_downcloud_cozy-store; fi - script: yarn build - deploy: - - provider: script - skip_cleanup: true - script: yarn cozyPublish - on: - branch: master - - provider: script - skip_cleanup: true - script: yarn cozyPublish - on: - tags: true diff --git a/package.json b/package.json index 73d2e6f56..866e94593 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "build": "cozy-scripts build --barV7 false", "watch": "cozy-scripts watch --barV7 false", "start": "cozy-scripts start --barV7 false", - "cozyPublish": "npx cozy-app-publish --token $REGISTRY_TOKEN --prepublish downcloud --postpublish mattermost", + "cozyPublish": "cozy-app-publish --token $REGISTRY_TOKEN --prepublish downcloud --postpublish mattermost", "test": "cs test --verbose --coverage", "stack:docker": "docker run --rm -it -p 8080:8080 -v \"$(pwd)/build\":/data/cozy-app/app cozy/cozy-app-dev" }, @@ -34,6 +34,7 @@ "@typescript-eslint/eslint-plugin": "5.54.0", "@typescript-eslint/parser": "5.54.0", "babel-preset-cozy-app": "^2.1.0", + "bundlemon": "1.4.0", "cozy-scripts": "^8.3.0", "cozy-tsconfig": "^1.2.0", "enzyme": "3.3.0", @@ -60,7 +61,6 @@ "@cozy/minilog": "^1.0.0", "@sentry/integrations": "^7.114.0", "@sentry/react": "^8.5.0", - "cozy-app-publish": "^0.27.2", "cozy-bar": "^15.0.0", "cozy-client": "^49.4.0", "cozy-device-helper": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index e976b1c2a..cbafbe55e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4618,6 +4618,29 @@ bundlemon-utils@^0.4.0: dependencies: bytes "^3.1.0" +bundlemon-utils@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/bundlemon-utils/-/bundlemon-utils-1.2.1.tgz#5585df0072c04c572a52abe0dc794578f96813ff" + integrity sha512-ydFZrI68L5j6hB9y88XGlbOp2lEwZHsDZl31ljHoi+wKE32glbuXMU0d0vQJLiR7Eq6uS0nDNYSmeoFHiV9R2g== + dependencies: + bytes "^3.1.0" + +bundlemon@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/bundlemon/-/bundlemon-1.4.0.tgz#5593e00cd913e638f69a489d4d97a9abecdac85d" + integrity sha512-A5mzeMZrnUzKNNo8ng1PFlxZr57XM2HDsaX07kJ1u59BDWn2JFYNeUIUSXhmLdoqBHK9Ln7wTLXDnoqOlcJP5A== + dependencies: + axios "^0.21.1" + brotli-size "^4.0.0" + bundlemon-utils "^1.0.0" + bytes "^3.1.0" + chalk "^4.1.1" + commander "^8.0.0" + cosmiconfig "^7.0.0" + gzip-size "^6.0.0" + micromatch "^4.0.4" + yup "^0.32.11" + bundlemon@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/bundlemon/-/bundlemon-1.3.2.tgz#164a038b1f4e8f520119367d3ba3b11a2372d19d"