Skip to content

Commit

Permalink
ci: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Apr 10, 2024
1 parent 5b6b9bb commit a382cac
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 193 deletions.
65 changes: 44 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,56 @@ name: CI

on:
push:
branches:
- master
branches: [master]
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp
pull_request:
branches:
- "**"
paths:
- grammar.js
- src/**
- test/**
- bindings/**
- binding.gyp

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
name: Test parser
runs-on: ${{matrix.os}}
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
os: [ubuntu-latest, windows-latest, macos-14]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up tree-sitter
uses: tree-sitter/setup-action/cli@v1
- name: Set up examples
run: |-
git clone https://github.com/odin-lang/Odin examples/Odin --single-branch --depth=1 --filter=blob:none
- name: Run tests
uses: tree-sitter/parser-test-action@v2
with:
node-version: 16
- run: npm install
- run: npm test

test_windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
test-rust: ${{runner.os == 'Linux'}}
- name: Parse examples
id: examples
continue-on-error: true
uses: tree-sitter/parse-action@v4
with:
files: examples/**/*.odin
invalid-files: |
examples/Odin/core/math/linalg/specific.odin
examples/Odin/core/runtime/internal.odin
- uses: actions/upload-artifact@v4
if: steps.examples.outputs.failures != ''
with:
node-version: 16
- run: npm install
- run: npm run-script test-windows
name: failures-${{matrix.os}}
path: ${{steps.examples.outputs.failures}}
15 changes: 7 additions & 8 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ name: Fuzz Parser

on:
push:
branches: [master]
paths:
- src/scanner.c
pull_request:
paths:
- src/scanner.c
workflow_dispatch:

jobs:
test:
name: Parser fuzzing
fuzz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: vigoux/tree-sitter-fuzz-action@v1
- name: Checkout repository
uses: actions/checkout@v4
- name: Run fuzzer
uses: tree-sitter/fuzz-action@v4
with:
language: odin
external-scanner: src/scanner.c
time: 60
tree-sitter-version: v0.22.2
19 changes: 13 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ name: Lint

on:
push:
branches:
- master
branches: [master]
paths:
- grammar.js
pull_request:
branches:
- "**"
paths:
- grammar.js

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version: ${{vars.NODE_VERSION}}
- name: Install modules
run: npm install
run: npm ci --legacy-peer-deps
- name: Run ESLint
run: npm run lint
94 changes: 17 additions & 77 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,21 @@
name: Publish
name: Publish package

on:
pull_request:
types: [closed]

permissions:
contents: write
push:
tags: ["*"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm test

publish:
if: github.event.pull_request.merged && startsWith(github.event.pull_request.title, 'chore(master):')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version
id: extract_version
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
VERSION=$(echo "$PR_TITLE" | grep -oP '(?<=release ).*$')
echo "::set-output name=version::$VERSION"
- name: Update versions
run: |
version="${{ steps.extract_version.outputs.version }}"
repo_name="${{ github.repository }}"
repo_name="${repo_name##*/}"
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git fetch origin master
git checkout master
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/g" package.json
sed -i "s/version = \"[^\"]*\"/version = \"$version\"/g" Cargo.toml
sed -i "s/$repo_name = \"[^\"]*\"/$repo_name = \"$version\"/g" bindings/rust/README.md
git add package.json Cargo.toml bindings/rust/README.md
git commit -m "chore(manifests): bump version to $version"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:master
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Publish to Crates.io
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- uses: actions/checkout@v3
- name: Tag stable versions
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
git tag -d stable || true
git push origin :stable || true
git tag -a stable -m "Last Stable Release"
git push origin stable
npm:
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
with:
package-name: "@tree-sitter-grammars/tree-sitter-yaml"
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}}
pypi:
uses: tree-sitter/workflows/.github/workflows/package-pypi.yml@main
secrets:
PYPI_API_TOKEN: ${{secrets.PYPI_TOKEN}}
35 changes: 0 additions & 35 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 0 additions & 2 deletions script/known_failures.txt

This file was deleted.

44 changes: 0 additions & 44 deletions script/parse-examples

This file was deleted.

0 comments on commit a382cac

Please sign in to comment.