diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 867a440..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,89 +0,0 @@ -# Javascript Node CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-javascript/ for more details - -version: 2 - -defaults: &defaults - working_directory: ~/repo - docker: - - image: cimg/node:24.14 - -jobs: - test: - <<: *defaults - steps: - - checkout - - run: - name: Install dependancies - command: npm ci - - run: - name: Lint - command: npm run lint - - run: - name: Build - command: npm run build - - run: - name: Install JUnit coverage reporter - command: npm install --save-dev jest-junit - - run: - name: Run tests - command: npx jest --listTests | circleci tests run --command="JEST_JUNIT_ADD_FILE_ATTRIBUTE=true xargs npx jest --config jest.config.json --silent --runInBand --" --verbose --split-by=timings - environment: - JEST_JUNIT_OUTPUT_DIR: ./reports/ - - store_test_results: - path: ./reports/ - - persist_to_workspace: - root: ~/repo - paths: - - . - - deploy-alpha: - <<: *defaults - steps: - - attach_workspace: - at: ~/repo - - run: - name: Authenticate with registry - command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc - - run: - name: Publish package - command: npm publish --tag alpha - - deploy-release: - <<: *defaults - steps: - - attach_workspace: - at: ~/repo - - run: - name: Publish to npm - command: | - npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN - npm publish - -workflows: - version: 2 - npm-deploy: - jobs: - - test: - filters: - tags: - only: /.*/ - - deploy-alpha: - context: reachfive - requires: - - test - filters: - tags: - only: /^v.*-alpha\.[0-9]/ - branches: - ignore: /.*/ - - deploy-release: - context: reachfive - requires: - - test - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e7ab8f4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: Continuous Integration + +on: + push: + branches: + - main + - master + - develop + pull_request: + branches: + - main + - master + - develop + +jobs: + test: + name: Build & Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npm run lint + + # - name: Check formatting + # run: npm run format:check + + - name: Install JUnit coverage reporter + run: npm install --save-dev jest-junit + + - name: Run tests + run: npm test -- --ci --reporters=default --reporters=jest-junit + + - name: Build + run: npm run build + + - uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: test-results + path: jest-junit.xml + env: + JEST_JUNIT_OUTPUT_NAME: jest-junit.xml diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml new file mode 100644 index 0000000..457f54d --- /dev/null +++ b/.github/workflows/deploy-release.yml @@ -0,0 +1,33 @@ +name: Deploy Release + +on: + push: + tags: + - 'v*' + +jobs: + deploy: + name: Deploy Release + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Publish to NPM + run: npm publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file