diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..96f4818d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,55 @@ +name: Node.js CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 22.x] + + env: + FAIL_IF_DIST_MESSAGE: "These files are autogenerated. Please don't include changes to these files in your PR" + # Set the timezone to Eastern Standard Time since that is what the library expects + TZ: "America/New_York" + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm install + + - name: Build project + run: npm run build + + - name: Run tests + run: npm run coverage + + - name: Run Coveralls + run: npm run coveralls + + - name: Check for changed dist files + run: | + git fetch origin main --depth=1 + # Check for changes in dist files, using grep's exit status directly + DIST_CHANGED=$(git diff --name-only HEAD origin/main | grep 'rickshaw\(\.min\)\?\.\(js\|css\)' || true) + if [ -n "$DIST_CHANGED" ]; then + echo -e "\033[31m${{ env.FAIL_IF_DIST_MESSAGE }}" + echo -e "\033[31mChanged files:" + echo "$DIST_CHANGED" + exit 1 + fi \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d082c53a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: node_js -node_js: - - "4" - - "12" - -env: - global: - - FAIL_IF_DIST_MESSAGE="These files are autogenerated. Please don't include changes to these files in your PR " - -before_script: - - npm run build - -after_script: - - npm run coverage - - npm run coveralls - - echo "Testing for changed dist files." - - DIST_CHANGED=`git diff --name-only HEAD $TRAVIS_BRANCH | egrep 'rickshaw(\.min)?\.(js|css)'`; [[ ! -z "$DIST_CHANGED" ]] && printf "\n\n" && echo -e "\033[31m$FAIL_IF_DIST_MESSAGE $DIST_CHANGED" && exit 1