From 5730b1dd8807aae2bc40f1b27df2aff109ef213a Mon Sep 17 00:00:00 2001 From: AlexisG Date: Wed, 16 Oct 2024 16:11:05 +0200 Subject: [PATCH] chore: Add CI with Github Actions And remove Travis --- .github/workflows/ci-cd.yml | 45 ++++++++++++++++++++++++ .travis.yml | 50 --------------------------- id_rsa_downcloud_contacts.enc | 2 -- package.json | 5 ++- yarn.lock | 65 +++++------------------------------ 5 files changed, 55 insertions(+), 112 deletions(-) create mode 100644 .github/workflows/ci-cd.yml delete mode 100644 .travis.yml delete mode 100644 id_rsa_downcloud_contacts.enc diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 000000000..942f41e70 --- /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":"contacts","beta":"contacts,publication","stable":"contacts,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 b308fe1e1..000000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -dist: jammy -language: node_js -cache: - npm: false -env: - global: - - MATTERMOST_CHANNEL='{"dev":"contacts","beta":"contacts,publication","stable":"contacts,publication"}' - # To generate a new key: travis encrypt GITHUB_TOKEN= -r cozy/cozy-contacts - - secure: "f56HAYQ1Y5K47uMJP2pptc030ZpOdHbzDwBf9RsVoxQfnIpu0Kk/AeTsHNOQQq8JaMmtr9mo1kOzM2xJncASNQDY9/ajUOncS+wQpB1TeKS2vuYD3pBtHGnDWg5wVuGB+Qyx0HUtG7hxDXtlgcxh0jq02gLoGxXz3LIHpiCsUamUtwv3xn9iXiXHHzdCkaD/pBWJvPfMAelhCm+qiN1G2OJJaHtbelQnYO4SOzTqtcFYjqa+H9Bne2ijj7ntVxxhuN1NDXMeHawblRXhwUZP78sJ75nhSAuux3jjNV2maPdPcrS10egkCP/WZXPzpT3+kAuUmbhkn4uNEtA9eECxHpskUDp/n+KOH+q4jGf6lF2z9OxL3KRIdzw+X0Agktq+4cjFWajVQhYaKTk9bGD1ZyOE+0evyxoTnKPjNfjTVg8nSl26w9gGZzxilbaGSJO+GZklsyb2WBl3omXLNvcpFf3RQbk8JYruRGQdESE6XbHBc16nmpMPMi7PS8DcgMqWHmnBTXoKwpe7o05ut4LLI+SGdqMms86KXFjRTxhOwGE/0P0HR9Jhbpn/lT+X1SRbspormciqx4YwkumNXi1627lcjjVwJf/RA39wM4EwoCF48hjAgSMWyg+cxs7dFnV1BZFi/VQIQ5IF6vZbI4wvvQKy8YHnlzUNuB/nXwZSq3I=" - # To generate a new key: travis encrypt REGISTRY_TOKEN= -r cozy/cozy-contacts - - secure: twmw7b05n3pvAYJr5V5PxQHdNY+4SP8W1WA9IWnUJmEuY8mi6L2Cxn08B8hrWEw6cPYg/fCkSWFkS1JZ+lmervSEipR7dPPP3aRMzDFe1p/9YcxNb9LdoRRAlxYRwreSvB7puVpr/kvXyWW2NzK1/OvU5o+HXJT5z3NJV0Zjw8v2IZ16vs1CyhbrmephAa2gEblzI1djRXDVK/9hGmT5shy7GVEmDgiufn13Dya1MiyPXLVvHoS6AzHFXCQKA6W6DsVjnYz5eQQAPd1dbT4hRlWrbtXDAY8ztFN15MeudFJn0/g7ZfH3iKs7+Wcr+5dwD5SxG3aFhgwQM0YE0ETVK5GQB+oyloGBHu3uuu0cPiIOfc+xbcHNT6a5igyfsfmiOtq+N5JeREp6codQDzByiFm0CxYNh2FUB4rU98kjkrT/F4UxbbnrHHPChqtGTvJ6RjfVuma3g2XioDnBsj0umNDCnHoa3GEGTq/wIAdhd6/B3i8MCNIq2eoLiJkVl83ITCjt7UdFZv6WHpVOvOL3iRsCS7gX7uresO0HXf6ws9FgRZm7P11jzsJIcHKBq4kXMS7XGIVLPMmB0R6OIh+kMXvtcQvSGXm0g+3hdCaF/hOHSmIUcrPFexvXoR5BH0kQvHMzijoY0552ySq5R3fY70a33S24aRA8QcuPMo7XXSo= - # To generate a new key: travis encrypt MATTERMOST_HOOK_URL= -r cozy/cozy-contacts - - secure: "B24hol+bj40GwMUA+jNYxklQA+c+lDJLZGRgz/gknQ5MhDUkmPgCuACkVivzzRq48jlXt0uSjfi/avtGqDA78q5AiuG1cNgGDGA+BKdI2bqqAevQEJ11lgC/U4PaxUtAJqB5MgR79gBb0XsHAtYfpCCKoySiIVqW4nZlPEtiOZLXfjQ1HJvv89BBtPySJli6JbSMMHfU1giZkbIrOXZwUWrGSUktUVDACQh+knZdC6X4bzywUC0WMzlHhRphmJxhmbTKKaBmv/JgoN9Qj50imG66cWoRC5Afva5M/86kix9VgO1a3xJZk4uTBz3KusPSryYvqTnWZ3lGWRqCa/aUXO0ogfemCjVupk1UPgYLqT3QOMSja+IozWR24yDDyXV1qr8fMupdV2M6FSRlEsfEesoIdpHqChD3SO9p7GLlvdwVeWqdT1zKUM9UEIQEE2bcHObyCHORZjgJC2MSBmVmawul48oG0Cpy1CbumaHHrvGnc0KO+zgl7qHxKGpBaCikIojuFCsZlBH+kS3Db6RZHRYyXiHeHIiDVLlKXQbl3uWiiC493uMRKetRwV/1refwGB+zYTJ+RurffmcZrGfPlUp7V2qnkswKffPlHJ2Zia1TH70u0pCeozxAjLGZlOv4toc3M0HNbXJfPY5cSzBgO1MYIe8gCVMLeMZkxCpg0bQ=" -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+)?$/ -jobs: - include: - - name: 'Lint' - script: yarn lint - - name: 'Unit tests' - script: yarn test - - name: Build - before_install: - - if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then openssl aes-256-cbc -K $encrypted_e51c23250372_key -iv $encrypted_e51c23250372_iv -in id_rsa_downcloud_contacts.enc -out /tmp/id_rsa_downcloud_contacts -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_contacts; - fi - - if [ "$TRAVIS_SECURE_ENV_VARS" != "false" ]; then ssh-add /tmp/id_rsa_downcloud_contacts; - fi - script: - - yarn build - - yarn bundlemon - before_deploy: - - yarn add cozy-app-publish - deploy: - - provider: script - repo: cozy/cozy-contacts - skip-cleanup: true - script: yarn run deploy - on: - branch: master - - provider: script - repo: cozy/cozy-contacts - skip-cleanup: true - script: yarn run deploy - on: - tags: true diff --git a/id_rsa_downcloud_contacts.enc b/id_rsa_downcloud_contacts.enc deleted file mode 100644 index cbfab6175..000000000 --- a/id_rsa_downcloud_contacts.enc +++ /dev/null @@ -1,2 +0,0 @@ -Eq>?τVQ L\#ˉ+A2>21x U'F/W8:\dk|+wmyo&gAqP5$H1컣}"MqTU {wu -(׻E 5z>x6Zb:-,RJZTGH`Mc<[L[Lael?4w"ͤ&(M(Mk./>ly ;`bu,ih&@.׮;^Ncp 2q3FyD&}2zytIM1n:z.n9)n{\%%+6__Sk_g%Z‘daLQŊZG^:Y]v@Seg ] TvF \ No newline at end of file diff --git a/package.json b/package.json index 7298e8ffb..a28f7f39d 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,10 @@ "build": "cozy-scripts build --browser --barV7 false", "watch": "cozy-scripts watch --browser --barV7 false", "start": "cozy-scripts start --browser --barV7 false", - "deploy": "cozy-app-publish --token $REGISTRY_TOKEN --build-dir 'build/' --prepublish downcloud --postpublish mattermost", + "cozyPublish": "cozy-app-publish --token $REGISTRY_TOKEN --build-dir 'build/' --prepublish downcloud --postpublish mattermost", "test": "cozy-scripts test", "stack:docker:dev": "docker run --rm -it -p 8080:8080 -p 5984:5984 -e COZY_DISABLE_CSP=1 -v \"$(pwd)/build\":/data/cozy-app/app cozy/cozy-app-dev", "stack:docker:prod": "docker run --rm -it -p 8080:8080 -p 5984:5984 -v \"$(pwd)/build\":/data/cozy-app/app cozy/cozy-app-dev", - "cozyPublish": "git fetch origin ${DEPLOY_BRANCH:-build}:${DEPLOY_BRANCH:-build} && cozy-scripts publish --token $REGISTRY_TOKEN --build-commit $(git rev-parse ${DEPLOY_BRANCH:-build})", "fixtures": "ACH import fixtures/contacts.json", "fixtures:drop": "ACH drop io.cozy.contacts io.cozy.contacts.groups", "fixtures:massive": "ACH import fixtures/massiveContacts.json", @@ -43,7 +42,7 @@ "@typescript-eslint/parser": "^5.54.0", "babel-preset-cozy-app": "^2.1.0", "browser-resolve": "^2.0.0", - "bundlemon": "2.0.1", + "bundlemon": "1.4.0", "cozy-app-publish": "^0.34.0", "cozy-jobs-cli": "^2.3.2", "cozy-scripts": "^8.3.0", diff --git a/yarn.lock b/yarn.lock index 8147cb985..26fe7b558 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3469,14 +3469,6 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== -axios-retry@^3.3.1: - version "3.4.0" - resolved "https://registry.yarnpkg.com/axios-retry/-/axios-retry-3.4.0.tgz#f464dbe9408e5aa78fa319afd38bb69b533d8854" - integrity sha512-VdgaP+gHH4iQYCCNUWF2pcqeciVOdGrBBAYUfTY+wPcO5Ltvp/37MLFNCmJKo7Gj3SHvCSdL8ouI1qLYJN3liA== - dependencies: - "@babel/runtime" "^7.15.4" - is-retry-allowed "^2.2.0" - axios@^0.21.1: version "0.21.4" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" @@ -3484,15 +3476,6 @@ axios@^0.21.1: dependencies: follow-redirects "^1.14.0" -axios@^1.1.3: - version "1.3.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.3.2.tgz#7ac517f0fa3ec46e0e636223fd973713a09c72b3" - integrity sha512-1M3O703bYqYuPhbHeya5bnhpYVsDDRyQSabNja04mZtboLNSuZ4YrltestrLXfHgmzua4TpUqRiVKbiQuo2epw== - dependencies: - follow-redirects "^1.15.0" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - babel-core@7.0.0-bridge.0: version "7.0.0-bridge.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" @@ -4062,31 +4045,14 @@ builtins@^1.0.3: resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" integrity sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ== -bundlemon-utils@^1.0.0, bundlemon-utils@^1.2.0: +bundlemon-utils@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/bundlemon-utils/-/bundlemon-utils-1.2.0.tgz#439f00930009293c9ce7c310716626a703560039" integrity sha512-yC8DPG8y6WyBxLYbwRs6yydPtcsWfgGmbUI8+LDPUa+zcMVCGSZOszysJ7SJGlnN7dI7PW+8Ed7RtWpOZI2hOQ== dependencies: bytes "^3.1.0" -bundlemon@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/bundlemon/-/bundlemon-2.0.1.tgz#2582dbe39ac1950e0f61f1b3fabb70213dcf042f" - integrity sha512-Mo3A9y6hdLjBPZd3O57xz4zJ0F9DMHiCL9dWdjwAn6mWISUSeaJF1fsNsKTGmOy/jEMzWHvkuidm0tFL0Fq04g== - dependencies: - axios "^1.1.3" - axios-retry "^3.3.1" - brotli-size "^4.0.0" - bundlemon-utils "^1.2.0" - bytes "^3.1.2" - chalk "^4.0.0" - commander "^9.4.0" - cosmiconfig "^7.0.1" - gzip-size "^6.0.0" - micromatch "^4.0.5" - yup "^0.32.11" - -bundlemon@^1.3.2: +bundlemon@1.4.0, bundlemon@^1.3.2: version "1.4.0" resolved "https://registry.yarnpkg.com/bundlemon/-/bundlemon-1.4.0.tgz#5593e00cd913e638f69a489d4d97a9abecdac85d" integrity sha512-A5mzeMZrnUzKNNo8ng1PFlxZr57XM2HDsaX07kJ1u59BDWn2JFYNeUIUSXhmLdoqBHK9Ln7wTLXDnoqOlcJP5A== @@ -4107,7 +4073,7 @@ bytes@3.0.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw== -bytes@3.1.2, bytes@^3.1.0, bytes@^3.1.2: +bytes@3.1.2, bytes@^3.1.0: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== @@ -4662,11 +4628,6 @@ commander@^8.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== -commander@^9.4.0: - version "9.5.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" - integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== - commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -4862,7 +4823,7 @@ cosmiconfig@^5.0.0: js-yaml "^3.13.1" parse-json "^4.0.0" -cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: +cosmiconfig@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6" integrity sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA== @@ -7353,7 +7314,7 @@ flush-write-stream@^1.0.0: inherits "^2.0.3" readable-stream "^2.3.6" -follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.15.0: +follow-redirects@^1.0.0, follow-redirects@^1.14.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== @@ -8737,11 +8698,6 @@ is-regex@^1.0.4, is-regex@^1.1.4: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-retry-allowed@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz#88f34cbd236e043e71b6932d09b0c65fb7b4d71d" - integrity sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg== - is-set@^2.0.1, is-set@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec" @@ -10560,7 +10516,7 @@ micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: +micromatch@^4.0.2, micromatch@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -10820,9 +10776,9 @@ msgpack5@^4.0.2: readable-stream "^2.3.6" safe-buffer "^5.1.2" -"mui-bottom-sheet@git+https://github.com/cozy/mui-bottom-sheet.git#v1.0.9": +"mui-bottom-sheet@https://github.com/cozy/mui-bottom-sheet.git#v1.0.9": version "1.0.8" - resolved "git+https://github.com/cozy/mui-bottom-sheet.git#3dc4c2a245ab39079bc2f73546bccf80847be14c" + resolved "https://github.com/cozy/mui-bottom-sheet.git#3dc4c2a245ab39079bc2f73546bccf80847be14c" dependencies: "@juggle/resize-observer" "^3.1.3" jest-environment-jsdom-sixteen "^1.0.3" @@ -12327,11 +12283,6 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" -proxy-from-env@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" - integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== - prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"