Skip to content

ci: setup scheduled CI job to test repository against the latest builds #1567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ orbs:
node: circleci/[email protected]
jobs:
build-and-test:
parameters:
dependency_type:
# Whether the test should build using the commit dependency versions or the latest builds.
type: enum
enum: ["package.json", "builds-repo"]
docker:
- image: cimg/node:14.18.1@sha256:50bd08d36e3b6b1bbc5172705f53630d439b959c94e11cdad7f4810f90c5f598
steps:
Expand All @@ -20,9 +25,25 @@ jobs:
pkg-manager: yarn
- run: scripts/lint.sh
- run: scripts/format.sh
- run: scripts/build.sh
- run: scripts/build.sh << parameters.dependency_type >>
- run: scripts/test.sh
workflows:
build-and-test:
jobs:
- build-and-test
- build-and-test:
name: build-and-test
dependency_type: "package.json"
buid-and-test-against-builds:
jobs:
- build-and-test:
name: build-and-test-builds-repo
dependency_type: "builds-repo"
triggers:
- schedule:
filters:
branches:
only:
- master
# Runs monitoring jobs at 10:00AM every day.
cron: '0 10 * * *'

2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- run: yarn install
- run: yarn install --cwd integration/project
- run: cd integration/project && yarn ngcc
- run: scripts/build.sh
- run: scripts/build.sh package.json
- run: xvfb-run -a yarn run test:e2e
if: runner.os == 'Linux'
- run: yarn run test:e2e
Expand Down
31 changes: 31 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
#!/usr/bin/env bash

DEPENDENCY_TYPE=$1
USE_PACKAGE_JSON=false
USE_BUILDS_REPO=false

if [ "$DEPENDENCY_TYPE" = "package.json" ]; then
USE_PACKAGE_JSON=true
echo "Using the dependencies defined in package.json"
elif [ "$DEPENDENCY_TYPE" = "builds-repo" ]; then
USE_BUILDS_REPO=true
echo "Use the latest dependency from builds repo."
else
echo "Please provide a valid dependency type as the first argument: 'package.json' or 'builds-repo'"
echo
echo "Usage example:"
echo " $0 package.json"
exit 1;
fi

if [ "$USE_BUILDS_REPO" = true ]; then
for dep in "language-service"; do
echo $(node -e "
const pkgJson = require('./package.json');
pkgJson['dependencies']['@angular/$dep'] = 'https://github.com/angular/$dep-builds.git';
console.log(JSON.stringify(pkgJson));
") > package.json
done
fi

set -ex -o pipefail

# Enable extended pattern matching features
Expand All @@ -9,6 +37,9 @@ shopt -s extglob
rm -rf dist
rm -rf **/*.tsbuildinfo


yarn install;

# Build the client and server
yarn run compile

Expand Down