From 36423e287b17bf214c360555a5b700509e8481a1 Mon Sep 17 00:00:00 2001 From: JF-Cozy Date: Wed, 7 Aug 2024 10:16:16 +0200 Subject: [PATCH] chore: Replace travis by github actions --- .github/workflows/deploy.yml | 56 +++++++++++ .travis.yml | 182 ----------------------------------- 2 files changed, 56 insertions(+), 182 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..a81b4a2941 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,56 @@ +name: Build and Deploy Cozy-ui +on: + push: + branches: [ master ] + pull_request: +env: + ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - name: Install packages + run: yarn install --frozen-lockfile --ignore-optional + - name: Lint + run: yarn lint + - name: Generate Sprite and Palette + run: yarn makeSpriteAndPalette + - name: Build JS + run: yarn build + - name: Build CSS + run: yarn build:css:all + - name: Build docs + run: | + yarn build:doc:react + yarn build:doc:kss + - name: Tests without snapshots + run: yarn test:noSnapshots + - name: Tests snapshots + run: yarn test:snapshots + # - name: Bundlemon + # run: yarn bundlemon + - name: Argos - Prepare env + run: | + yarn add puppeteer@"21.11.0" --dev --exact + mkdir ./screenshots + - name: Argos - Create desktop screenshots + run: yarn screenshots --mode react --viewport desktop --screenshot-dir ./screenshots/reactDesktop + - name: Argos - Create mobile screenshots + run: yarn screenshots --mode react --viewport 300x600 --screenshot-dir ./screenshots/reactMobile + - name: Argos - Create kss screenshots + run: yarn screenshots --mode kss --screenshot-dir ./screenshots/kss + - name: Argos - Upload all screenshots + run: | + yarn argos:upload --parallel screenshots/reactDesktop/ --token $ARGOS_TOKEN --parallel-total 3 --parallel-nonce $GITHUB_RUN_ID --ignore '' + yarn argos:upload --parallel screenshots/reactMobile/ --token $ARGOS_TOKEN --parallel-total 3 --parallel-nonce $GITHUB_RUN_ID --ignore '' + yarn argos:upload --parallel screenshots/kss/ --token $ARGOS_TOKEN --parallel-total 3 --parallel-nonce $GITHUB_RUN_ID --ignore '' + - name: Deploy + if: ${{ github.ref_name == 'master' }} + run: | + yarn deploy:doc --username cozycloud --email contact@cozycloud.cc --repo https://cozy-bot:$GH_TOKEN@github.com/cozy/cozy-ui.git + yarn semantic-release diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2157c8b21b..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,182 +0,0 @@ -language: node_js -dist: jammy -cache: - npm: false -if: type NOT IN (pull_request) -env: - global: - - PR_TITLE=$(curl https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST} 2> /dev/null | grep "title" | head -1) -stages: - - Prebuild - - Build - - Docs - - Test - - Screenshots - Create - - Screenshots - Upload - - Deploy -jobs: - include: - - name: 'Lint' - stage: 'Prebuild' - script: yarn lint - if: commit_message =~ /^((?!\[only argos\]).)*$/ # skipped if commit message contains "[only argos]" - - name: 'Generate Sprite and Palette' - stage: 'Prebuild' - script: yarn makeSpriteAndPalette - workspaces: - create: - name: sprite-palette-binaries - paths: - - ./react/Icon/icons-sprite.js - - ./react/palette.js - - name: 'Build JS' - stage: 'Build' - script: - - yarn build - workspaces: - use: - - sprite-palette-binaries - create: - name: js-binaries - paths: - - ./transpiled - - name: 'Build CSS' - stage: 'Build' - script: - - yarn build:css:all - workspaces: - create: - name: css-binaries - paths: - - ./dist - - name: 'Build docs' - stage: 'Docs' - script: - - yarn build:doc:react - - yarn build:doc:kss - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - create: - name: docs-binaries - paths: - - ./build - - name: 'Tests without snapshots' - stage: 'Test' - script: - - yarn test:noSnapshots - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - if: commit_message =~ /^((?!\[only argos\]).)*$/ # skipped if commit message contains "[only argos]" - - name: 'Tests snapshots' - stage: 'Test' - script: - - yarn test:snapshots - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - if: commit_message =~ /^((?!\[only argos\]).)*$/ # skipped if commit message contains "[only argos]" - - name: 'Bundlemon' - stage: 'Test' - script: - - yarn bundlemon - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - if: commit_message =~ /^((?!\[only argos\]).)*$/ # skipped if commit message contains "[only argos]" - - name: '[Argos] Create desktop screenshots' - stage: 'Screenshots - Create' - script: | - if [[ "${PR_TITLE}" != *"[skip argos]"* ]]; then - mkdir ./screenshots - npx puppeteer browsers install chrome - yarn screenshots --mode react --viewport desktop --screenshot-dir ./screenshots/reactDesktop - fi - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - - docs-binaries - create: - name: screenshots-desktop-binaries - paths: - - ./screenshots - - name: '[Argos] Create mobile screenshots' - stage: 'Screenshots - Create' - script: | - if [[ "${PR_TITLE}" != *"[skip argos]"* ]]; then - mkdir ./screenshots - npx puppeteer browsers install chrome - yarn screenshots --mode react --viewport 300x600 --screenshot-dir ./screenshots/reactMobile - fi - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - - docs-binaries - create: - name: screenshots-mobile-binaries - paths: - - ./screenshots - - name: '[Argos] Create kss screenshots' - stage: 'Screenshots - Create' - script: | - if [[ "${PR_TITLE}" != *"[skip argos]"* ]]; then - mkdir ./screenshots - npx puppeteer browsers install chrome - yarn screenshots --mode kss --screenshot-dir ./screenshots/kss - fi - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - - docs-binaries - create: - name: screenshots-kss-binaries - paths: - - ./screenshots - - name: '[Argos] Upload all screenshots' - stage: 'Screenshots - Upload' - script: | - if [[ "${PR_TITLE}" != *"[skip argos]"* ]]; then - yarn argos:upload --parallel screenshots/reactDesktop/ --token $ARGOS_TOKEN --parallel-total 3 --parallel-nonce $TRAVIS_BUILD_ID --ignore '' - yarn argos:upload --parallel screenshots/reactMobile/ --token $ARGOS_TOKEN --parallel-total 3 --parallel-nonce $TRAVIS_BUILD_ID --ignore '' - yarn argos:upload --parallel screenshots/kss/ --token $ARGOS_TOKEN --parallel-total 3 --parallel-nonce $TRAVIS_BUILD_ID --ignore '' - fi - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - - docs-binaries - - screenshots-desktop-binaries - - screenshots-mobile-binaries - - screenshots-kss-binaries - - name: 'Deploy' - stage: 'Deploy' - script: 'true' - if: commit_message =~ /^((?!\[only argos\]).)*$/ # skipped if commit message contains "[only argos]" - workspaces: - use: - - sprite-palette-binaries - - js-binaries - - css-binaries - - docs-binaries - deploy: - provider: script - skip-cleanup: true - script: yarn deploy:doc -- --username cozycloud --email contact@cozycloud.cc --repo https://cozy-bot:$GH_TOKEN@github.com/cozy/cozy-ui.git && yarn semantic-release - on: - branch: master