Skip to content

Commit

Permalink
github actions for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bholloway committed Jan 17, 2022
1 parent dd8222b commit 6787839
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ci
on:
- push
jobs:
test:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
node:
- '12.x'
- '14.x'
- 'lts/*'
band:
- 'webpack4'
- 'webpack5'
steps:
- name: Use OS ${{ matrix.os }}
uses: actions/checkout@v2
- name: Use Node@${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install Dependencies
run: yarn install
- name: Unit test
run: yarn test:unit
- name: End-to-End test ${{ matrix.band }}
if: ${{ !(matrix.node == 'lts/*' && matrix.band == 'webpack4') }}
run: yarn test:e2e
env:
ONLY: '${{ matrix.band }}*'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "webpack4-sassloader8-nodesass4",
"version": "1.0.0",
"engines": {
"node": ">=12.0.0"
"node": ">=12.0.0 <16.0.0"
},
"dependencies": {
"css-loader": "^5.2.4",
Expand Down
7 changes: 4 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const {dirname, normalize, join} = require('path');
const {readdirSync} = require('fs');
const {platform: os} = require('process');
const {platform: os, version} = require('process');
const compose = require('compose-function');
const sequence = require('promise-compose');
const micromatch = require('micromatch');
Expand All @@ -16,6 +16,7 @@ const {testBase} = require('./cases/common/test');
// tests are located in resolve-url-loader package which might differ from package under test
const PLATFORMS_DIR = compose(normalize, join)(__dirname, '..', 'packages', 'resolve-url-loader', 'test');
const CASES_DIR = join(__dirname, 'cases');
const VERSION_MAJOR = version.match(/\d+/).shift();

const testIncluded = process.env.ONLY ?
(arr) => {
Expand Down Expand Up @@ -69,7 +70,7 @@ filterTests()
platform,
sequence(
init({
directory: [process.cwd(), join('tmp', '.cache'), platform],
directory: [process.cwd(), join('tmp', '.cache'), `node${VERSION_MAJOR}-${platform}`],
ttl: false,
debug: (process.env.DEBUG === 'true'),
env: {
Expand Down Expand Up @@ -131,7 +132,7 @@ filterTests()
RESOLVE_URL_LOADER_TEST_HARNESS: 'stderr'
}),
meta({
cacheDir: join(process.cwd(), 'tmp', '.cache', platform),
cacheDir: join(process.cwd(), join('tmp', '.cache'), `node${VERSION_MAJOR}-${platform}`),
version: getVersionHash(platform)
}),
...filterTests(platform).map(caseName => require(join(CASES_DIR, caseName)))
Expand Down

0 comments on commit 6787839

Please sign in to comment.