Remove unused dependencies #472
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Upload to S3 | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags: | |
| - '**' | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Cache dependencies | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 16 | |
| cache: 'yarn' | |
| - name: Install code | |
| run: yarn install --frozen-lock-file | |
| - name: eslint | |
| run: yarn lint | |
| - name: stylelint | |
| run: yarn stylelint | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v1 | |
| - name: Cache dependencies | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 16 | |
| cache: 'yarn' | |
| - name: Install code | |
| run: yarn install --frozen-lock-file | |
| - name: Run tests | |
| run: yarn test | |
| test-cypress: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v1 | |
| - name: Cache dependencies | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 16 | |
| cache: 'yarn' | |
| - name: Install code | |
| run: yarn install --frozen-lock-file | |
| - name: Cypress run | |
| uses: cypress-io/github-action@v4 | |
| with: | |
| install: false | |
| start: | | |
| yarn start | |
| yarn start:wc | |
| wait-on: 'http://localhost:3000, http://localhost:3001' | |
| env: | |
| PUBLIC_URL: 'http://localhost:3000' | |
| - name: Archive cypress artifacts | |
| uses: actions/upload-artifact@v3 | |
| if: failure() | |
| with: | |
| name: cypress-artifacts | |
| path: | | |
| cypress/screenshots | |
| cypress/videos | |
| build-deploy: | |
| needs: | |
| - test | |
| # Disabling test-cypress while it is flaky | |
| # - test-cypress | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v1 | |
| - name: Cache dependencies | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 16 | |
| cache: 'yarn' | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: eu-west-2 | |
| - name: Set bucket | |
| run: | | |
| if [ ${{ github.ref_type }} == 'tag' ]; then | |
| echo "Deploying to production bucket" | |
| echo "bucket=python-editor-dist-test" >> $GITHUB_ENV | |
| else | |
| echo "Deploying to staging/preview bucket" | |
| echo "bucket=python-editor-dist-test" >> $GITHUB_ENV | |
| fi | |
| shell: bash | |
| - name: Set deploy directory | |
| run: | | |
| if [ ${{ github.ref_type }} == 'tag' ]; then | |
| echo "Deploying tagged release ${{ github.ref_name }}" | |
| echo "deploy_dir=${{ github.ref_name }}" >> $GITHUB_ENV | |
| elif [ ${{ github.ref }} == 'refs/head/main' ]; then | |
| echo "Deploying staging release" | |
| echo "deploy_dir=staging" >> $GITHUB_ENV | |
| else | |
| echo "Deploying preview release ${{ github.ref_name }}" | |
| echo "deploy_dir=previews/${{ github.ref_name }}" >> $GITHUB_ENV | |
| fi | |
| shell: bash | |
| - name: Set PUBLIC_URL | |
| run: | | |
| public_url=https://${{ env.bucket }}.s3.eu-west-2.amazonaws.com/${{ env.deploy_dir }} | |
| echo "Setting PUBLIC_URL to $public_url" | |
| echo PUBLIC_URL=$public_url >> $GITHUB_ENV | |
| shell: bash | |
| - name: Install code | |
| run: yarn install --frozen-lock-file | |
| - name: Build site and WC bundle | |
| run: | | |
| yarn build | |
| yarn build:wc | |
| - name: Deploy site to S3 bucket | |
| run: aws s3 sync ./build/ s3://${{ env.bucket }}/${{ env.deploy_dir }} --delete |