diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5c7e6f..9ffc6a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,20 @@ name: CI + on: push: branches: [master] + paths: pull_request: - branches: [master] + jobs: build: + name: Run tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: tree-sitter/setup-action@v1 + with: + install-lib: false + - uses: tree-sitter/parser-test-action@v1.2 with: - node-version: '16' - - name: Install dependencies - run: npm ci - - name: Run tests - run: npm test + test-library: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ae6ba35 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,15 @@ +name: Publish package + +on: + push: + tags: ["*"] + +jobs: + npm: + uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main + secrets: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + crates: + uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main + secrets: + CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_TOKEN}} diff --git a/.github/workflows/update-cpp-parser.yml b/.github/workflows/update-cpp-parser.yml index 70fb9de..7ad57bc 100644 --- a/.github/workflows/update-cpp-parser.yml +++ b/.github/workflows/update-cpp-parser.yml @@ -1,49 +1,25 @@ -name: Update Dependencies +name: Update + on: schedule: - - cron: '0 0/4 * * *' # every day at midnight - push: - branches: ["master"] + - cron: "0 0 * * 0" + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + jobs: - build: + test: + name: Update dependencies runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: '16' - - name: Update scanner - run: | - curl https://raw.githubusercontent.com/tree-sitter/tree-sitter-cpp/master/src/scanner.c -o src/scanner.c - sed -i 's/tree_sitter_cpp/tree_sitter_cuda/g' src/scanner.c - git diff - - name: Update C++ parser - run: npm update - - name: Install dependencies - run: npm ci - - name: Regenerate Source Files - run: node_modules/.bin/tree-sitter generate - - name: Generate parser - run: npm install - - name: Run tests - run: | - git submodule init - git submodule update - cd tree-sitter-cpp && git checkout origin/master && cd .. - cp -r tree-sitter-cpp/test/corpus/* test/corpus - node_modules/.bin/tree-sitter test - - - name: Commit changes - run: | - git config user.name "GitHub" - git config user.email "noreply@github.com" - git commit -am "Update dependencies and regenerate parser" || echo 'No commit necessary!' - git clean -xf - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + cache: npm + node-version: ${{vars.NODE_VERSION}} + - uses: tree-sitter/parser-update-action@v1.1 with: - commit-message: Update dependencies - title: Update dependencies - branch: update-dependencies-pr - base: ${{ github.head_ref }} + parent-name: cpp + language-name: cuda