From c3921223bd35e94c78dd670642a148c0cf5dfe3a Mon Sep 17 00:00:00 2001 From: Spiros Economakis Date: Tue, 10 Jan 2023 14:54:18 +0200 Subject: [PATCH] Migrate from CircleCI to Github actions We can use across all the repositories of plugins and apps the same reusable workflow which give us the ability to change only one file instead of multiple and apart from this the ability to use different versions as we prefer. Ticket: https://mattermost.atlassian.net/browse/CLD-4816 --- .circleci/config.yml | 63 ------------------------------ .github/workflows/cd.yml | 17 ++++++++ .github/workflows/ci.yml | 83 ++++++---------------------------------- 3 files changed, 29 insertions(+), 134 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/cd.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 9e22b712..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,63 +0,0 @@ -version: 2.1 - -orbs: - plugin-ci: mattermost/plugin-ci@volatile - -workflows: - version: 2 - nightly: - triggers: - - schedule: - cron: "0 0 * * *" - filters: - branches: - only: - - master - jobs: - - plugin-ci/lint - - plugin-ci/test - - plugin-ci/build - ci: - jobs: - - plugin-ci/lint: - filters: - tags: - only: /^v.*/ - - plugin-ci/test: - filters: - tags: - only: /^v.*/ - - plugin-ci/coverage: - filters: - tags: - only: /^v.*/ - requires: - - plugin-ci/test - - plugin-ci/build: - filters: - tags: - only: /^v.*/ - requires: - - plugin-ci/test - - plugin-ci/deploy-ci: - filters: - branches: - only: master - context: plugin-ci - requires: - - plugin-ci/lint - - plugin-ci/coverage - - plugin-ci/build - - plugin-ci/test - - plugin-ci/deploy-release-github: - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ - context: matterbuild-github-token - requires: - - plugin-ci/lint - - plugin-ci/coverage - - plugin-ci/build - - plugin-ci/test diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000..1b2673ce --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,17 @@ +name: cd +on: + workflow_run: + workflows: ["ci"] + types: + - completed + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +permissions: + contents: read + +jobs: + plugin-cd: + uses: mattermost/actions-workflows/.github/workflows/plugin-cd.yml@master + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 564bc13f..f76939ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,77 +1,18 @@ -# Continuous Integration Workflow to check pushes to master and pull requests: -# - code style guidelines are followed (make check-style) -# - tests pass (make test) -# - code builds (make dist) -name: CI - +name: ci on: - pull_request: + schedule: # nightly builds + - cron: "0 0 * * *" push: branches: - master + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + pull_request: -jobs: - ci: - name: Check style; build; test - runs-on: ubuntu-latest - - steps: - - name: Set up Go v1.16.x - uses: actions/setup-go@v2 - with: - go-version: 1.16.x - - - name: Set up Node.js v14.x - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - uses: actions/checkout@v2 - - - name: Install golangci - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0 - - - name: Cache go modules - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - name: Install webapp dependencies - run: make webapp/node_modules - env: - TERM: dumb - - - name: check style - run: make check-style - env: - TERM: dumb - - - name: run tests - run: make test - env: - TERM: dumb - - - name: Build and bundle the plugin - id: build - run: | - make dist - echo ::set-output name=BUNDLE_NAME::$(cd dist; ls *.tar.gz) - env: - TERM: dumb +permissions: + contents: read - - name: Upload the built plugin as an artifact - uses: actions/upload-artifact@v2 - with: - name: ${{ steps.build.outputs.BUNDLE_NAME }} - path: dist/${{ steps.build.outputs.BUNDLE_NAME }} +jobs: + plugin-ci: + uses: mattermost/actions-workflows/.github/workflows/plugin-ci.yml@master + secrets: inherit