From a5ad616bc8f224771582a377da009e80ed2dc083 Mon Sep 17 00:00:00 2001 From: Bastian Meissner Date: Sun, 30 Jan 2022 12:44:32 +0100 Subject: [PATCH] Replace CircleCI with GitHub Actions --- .circleci/config.yml | 101 ------------------------------------- .github/workflows/main.yml | 97 +++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 101 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/main.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 53d6c3c..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,101 +0,0 @@ -version: 2.1 - -commands: - install_dependencies: - description: "Installs dependencies and uses CircleCI's cache" - steps: - - checkout - - restore_cache: - keys: - - dependencies-{{ checksum "yarn.lock" }} - - dependencies- - - run: - command: | - yarn install - - save_cache: - paths: - - node_modules - key: dependencies-{{ checksum "yarn.lock" }} - -jobs: - style: - docker: - - image: node:latest - steps: - - install_dependencies - - run: - name: prettier - command: | - yarn prettier --check - - run: - name: lint - command: | - yarn lint - - dashboard: - docker: - - image: node:latest - steps: - - install_dependencies - - run: - name: typecheck - command: | - yarn typecheck - - run: - name: test - command: | - yarn test --coverage - - run: - name: coverage - command: | - yarn coverage - - build: - docker: - - image: docker:latest - steps: - - checkout - - setup_remote_docker: - version: 20.10.7 - - run: - name: Log in to Docker - command: | - docker login --username ${DOCKER_USER} --password ${DOCKER_PASSWORD} - - run: - name: Install docker buildx - command: | - apk add --no-cache curl - mkdir -p ~/.docker/cli-plugins - baseUrl="https://github.com/docker/buildx/releases/download" - fileName="buildx-v0.7.1.linux-amd64" - url="${baseUrl}/v0.7.1/${fileName}" - curl -sSL -o ~/.docker/cli-plugins/docker-buildx $url - chmod a+x ~/.docker/cli-plugins/docker-buildx - echo 'export DOCKER_CLI_EXPERIMENTAL="enabled"' >> $BASH_ENV - - run: - name: Prepare docker buildx - command: | - docker buildx install - docker version - docker buildx version - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - docker context create xbuilder - docker buildx create xbuilder --name xbuilder --driver-opt image=moby/buildkit:master --use - docker buildx inspect --bootstrap - - run: - name: Build all platforms - command: | - docker buildx build \ - --platform=linux/amd64,linux/arm64/v8,linux/arm/v7 \ - -t phntxx/dashboard:latest --push . - -workflows: - version: 2 - dashboard: - jobs: - - style - - dashboard - - build: - requires: - - style - - dashboard diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..446167c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,97 @@ +name: Tests and push apps + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + style: + runs-on: ubuntu-latest + steps: + + - name: Checkout repository + uses: actions/checkout@master + + - name: Setup node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Install dependencies + uses: borales/actions-yarn@v2.3.0 + with: + cmd: install + + - name: Check code formatting + uses: borales/actions-yarn@v2.3.0 + with: + cmd: prettier --check + + - name: Check code linting + uses: borales/actions-yarn@v2.3.0 + with: + cmd: lint + + dashboard: + runs-on: ubuntu-latest + steps: + + - name: Checkout repository + uses: actions/checkout@master + + - name: Setup node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: Install dependencies + uses: borales/actions-yarn@v2.3.0 + with: + cmd: install + + - name: Check code typing + uses: borales/actions-yarn@v2.3.0 + with: + cmd: typecheck + + - name: Run unit tests + uses: borales/actions-yarn@v2.3.0 + with: + cmd: test --coverage + + - name: Codecov + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true + + build: + runs-on: ubuntu-latest + needs: [style, dashboard] + steps: + + - name: Checkout repository + uses: actions/checkout@master + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + push: true + platforms: linux/amd64,linux/arm64/v8,linux/arm/v7 + tags: phntxx/dashboard:latest \ No newline at end of file