Skip to content

Commit

Permalink
🏗 Clean up CI config files (#32303)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha committed Jan 29, 2021
1 parent 87a3e9b commit b74e527
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .circleci/fetch_merge_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the license.
#
# This script fetches the merge commit of a PR branch with master to make sure
# PRs are tested against all the latest changes.
# PRs are tested against all the latest changes on CircleCI.
#
# Reference: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables.

Expand Down
6 changes: 3 additions & 3 deletions .circleci/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the license.
#
# Script used by AMP's CI builds to install project dependencies.
# Script used by AMP's CI builds to install project dependencies on CircleCI.

set -e

Expand All @@ -38,7 +38,7 @@ echo $(GREEN "Installing dependencies...")
npm ci

echo $(GREEN "Setting up environment...")
NODE_BIN=`which node`
(set -x && echo "export PATH=`dirname $NODE_BIN`:$PATH" >> $BASH_ENV)
NPM_BIN_DIR="`npm config get prefix`/bin"
(set -x && echo "export PATH=$NPM_BIN_DIR:$PATH" >> $BASH_ENV)

echo $(GREEN "Successfully installed all project dependencies.")
2 changes: 1 addition & 1 deletion .circleci/setup_storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the license.
#
# Script used by AMP's CI builds to authenticate with their GCP storage bucket.
# Script used by AMP's CI builds to authenticate with GCP storage on CircleCI.
# TODO(rsimha, ampproject/amp-github-apps#1110): Update storage details.

set -e
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/cross-browser-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cross-Browser Tests
name: GitHub Actions
on:
push:
branches:
Expand All @@ -12,19 +12,13 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
node-version: [12.x]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Up Environment
if: ${{ matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'}}
run: sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
- name: Install Gulp CLI
run: npm install --global --force gulp-cli
- name: Install Dependencies
run: npm install
run: bash ./.github/workflows/install_dependencies.sh
- name: Build and Test
run: node build-system/pr-check/cross-browser-tests.js
38 changes: 38 additions & 0 deletions .github/workflows/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
#
# Copyright 2021 The AMP HTML Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the license.
#
# Script used by AMP's CI builds to install project dependencies on GH Actions.

set -e

GREEN() { echo -e "\033[0;32m$1\033[0m"; }

if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
echo $(GREEN "Updating npm prefix...")
npm config set prefix "$HOME/.npm"

echo $(GREEN "Updating PATH...")
echo "export PATH=$HOME/.npm/bin:$PATH" >> $GITHUB_ENV && source $GITHUB_ENV # For now
echo "$HOME/.npm/bin" >> $GITHUB_PATH # For later
fi

echo $(GREEN "Installing gulp-cli...")
npm install --global gulp-cli

echo $(GREEN "Installing dependencies...")
npm ci

echo $(GREEN "Successfully installed all project dependencies.")

0 comments on commit b74e527

Please sign in to comment.