Skip to content

Commit

Permalink
Test on multiple versions of Angular (#1672)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored May 24, 2021
1 parent 436b0b1 commit 1ff7ea1
Show file tree
Hide file tree
Showing 3 changed files with 6,187 additions and 10 deletions.
94 changes: 86 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ name: CI
on: [pull_request, push]

jobs:
test:
name: Test on node ${{ matrix.node_version }}
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [12, 14]

steps:
- uses: actions/checkout@master

- name: Use Node.js ${{ matrix.node_version }}
- name: Use Node.js 14
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node_version }}
node-version: 14

- uses: actions/cache@v2
name: Cache node_modules
Expand All @@ -32,5 +28,87 @@ jobs:
- name: Build
run: yarn build

- uses: actions/cache@v2
name: Share build
with:
path: 'packages/apollo-angular/build'
key: ${{ github.sha }}

- name: Pack
run: (cd packages/apollo-angular/build && yarn pack --filename apollo-angular.tgz && mv apollo-angular.tgz ../apollo-angular.tgz)

- uses: actions/cache@v2
name: Share tarball
with:
path: 'packages/apollo-angular/apollo-angular.tgz'
key: ${{ github.sha }}

tests:
name: Tests
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: Use Node.js 14
uses: actions/setup-node@master
with:
node-version: 14

- uses: actions/cache@v2
name: Cache node_modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
run: yarn

- uses: actions/cache@v2
name: Share build
with:
path: 'packages/apollo-angular/build'
key: ${{ github.sha }}

- name: Test
run: yarn test

angular:
name: Test on Angular ${{ matrix.angular_version }}
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
angular_version: [9, 10, 11, 12]
steps:
- name: Use Node.js 14
uses: actions/setup-node@master
with:
node-version: 14

- uses: actions/cache@v2
name: Share tarball
with:
path: 'packages/apollo-angular/apollo-angular.tgz'
key: ${{ github.sha }}

- name: Install Angular CLI
run: npm install @angular/cli@${{ matrix.angular_version }} --global

- name: ng new
run: ng new testapp --package-manager yarn --defaults --minimal --skip-git

- name: ng add apollo-angular
if: ${{ matrix.angular_version >= 12 }}
run: (cd testapp && ng add ../packages/apollo-angular/apollo-angular.tgz --defaults --verbose --skip-confirmation)

- name: ng add apollo-angular
if: ${{ matrix.angular_version < 12 }}
run: (cd testapp && ng add ../packages/apollo-angular/apollo-angular.tgz --defaults --verbose)

- name: ng build
run: (cd testapp && yarn ng run testapp:build:production)

2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ jspm_packages

# Packages lock
package-lock.json
yarn.lock
packages/**/package-lock.json
packages/**/yarn.lock

# npm directories (for deploying)
packages/*/npm/
Expand Down
Loading

0 comments on commit 1ff7ea1

Please sign in to comment.