From a59a9be78b4d99462187533cb26a1a0504d936b6 Mon Sep 17 00:00:00 2001 From: AlinaFirsova <67948652+AlinaFirsova@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:45:42 +0000 Subject: [PATCH 1/6] CI/CD GitHub Actions added --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..2553710db --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: Miew CI/CD + +on: [push, pull_request] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + node_modules + ~/.sonar/cache + ~/.yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install specific version of Yarn + run: | + curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 + echo "$HOME/.yarn/bin" >> $GITHUB_PATH + + - name: Setup Code Climate test-reporter + run: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter + chmod +x /tmp/cc-test-reporter + + - name: Install dependencies and run CI script + run: | + yarn install + yarn run ci + + - name: After success steps + run: | + sonar-scanner + npm run coveralls + if [ "${{ github.event_name }}" != "pull_request" ]; then + /tmp/cc-test-reporter after-build --exit-code $? + fi + + deploy: + needs: build-and-test + runs-on: ubuntu-latest + steps: + - name: NPM Deployment + if: startsWith(github.ref, 'refs/tags/v') && matrix.node == 18 + run: | + # Ensure you set up the NPM_AUTH_TOKEN secret in your GitHub repository + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc + npm publish --tag latest From 2caa3fd02323a55ad5c0ca8c107107c7c5a48c7d Mon Sep 17 00:00:00 2001 From: AlinaFirsova <67948652+AlinaFirsova@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:52:12 +0000 Subject: [PATCH 2/6] yarn version bumped --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2553710db..b5b188f79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - name: Install specific version of Yarn run: | - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 + curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 3.6.3 echo "$HOME/.yarn/bin" >> $GITHUB_PATH - name: Setup Code Climate test-reporter From 475a58b5f13576b8278a37bf2f8a9e518ff7c146 Mon Sep 17 00:00:00 2001 From: AlinaFirsova <67948652+AlinaFirsova@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:56:46 +0000 Subject: [PATCH 3/6] specific version installation removed --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5b188f79..5151dfddc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,11 +25,6 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - - name: Install specific version of Yarn - run: | - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 3.6.3 - echo "$HOME/.yarn/bin" >> $GITHUB_PATH - - name: Setup Code Climate test-reporter run: | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter From 6eecc462aad61f7da00021f36288c2ba98f27ac3 Mon Sep 17 00:00:00 2001 From: AlinaFirsova <67948652+AlinaFirsova@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:09:05 +0000 Subject: [PATCH 4/6] Temporary removal of sonar-scanner --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5151dfddc..7392e6334 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,13 +35,13 @@ jobs: yarn install yarn run ci - - name: After success steps - run: | - sonar-scanner - npm run coveralls - if [ "${{ github.event_name }}" != "pull_request" ]; then - /tmp/cc-test-reporter after-build --exit-code $? - fi + # - name: After success steps + # run: | + # sonar-scanner + # npm run coveralls + # if [ "${{ github.event_name }}" != "pull_request" ]; then + # /tmp/cc-test-reporter after-build --exit-code $? + # fi deploy: needs: build-and-test From a00002f71d97cc8f4d126bb9433902fb417c207a Mon Sep 17 00:00:00 2001 From: AlinaFirsova <67948652+AlinaFirsova@users.noreply.github.com> Date: Thu, 26 Oct 2023 15:39:25 +0000 Subject: [PATCH 5/6] Temporary removal of sonar-scanner --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7392e6334..f1846df0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,14 +35,6 @@ jobs: yarn install yarn run ci - # - name: After success steps - # run: | - # sonar-scanner - # npm run coveralls - # if [ "${{ github.event_name }}" != "pull_request" ]; then - # /tmp/cc-test-reporter after-build --exit-code $? - # fi - deploy: needs: build-and-test runs-on: ubuntu-latest From f1d7b349c03a21b327ed52ebe1f98e8517674e7b Mon Sep 17 00:00:00 2001 From: AlinaFirsova <67948652+AlinaFirsova@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:06:17 +0000 Subject: [PATCH 6/6] Changes after code review --- .github/workflows/ci.yml | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1846df0b..654953c7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Miew CI/CD on: [push, pull_request] jobs: - build-and-test: + build: runs-on: ubuntu-latest steps: - name: Checkout code @@ -13,35 +13,10 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 + cache: 'yarn' - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: | - node_modules - ~/.sonar/cache - ~/.yarn - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Setup Code Climate test-reporter - run: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /tmp/cc-test-reporter - chmod +x /tmp/cc-test-reporter - - - name: Install dependencies and run CI script - run: | - yarn install - yarn run ci + - name: Install dependencies + run: yarn install - deploy: - needs: build-and-test - runs-on: ubuntu-latest - steps: - - name: NPM Deployment - if: startsWith(github.ref, 'refs/tags/v') && matrix.node == 18 - run: | - # Ensure you set up the NPM_AUTH_TOKEN secret in your GitHub repository - echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc - npm publish --tag latest + - name: Run CI script + run: yarn run ci