Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gaymeowing committed Aug 17, 2024
1 parent 6a28440 commit 8d87a59
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- "scripts/diff_to_tbl.luau"
- "scripts/test_runner.luau"
- "scripts/depgraph.luau"
- "scripts/mock/**"
- "testkit.luau"
pull_request:
branches: [ main ]
Expand All @@ -16,13 +17,12 @@ on:
- "scripts/test_runner.luau"
- "scripts/depgraph.luau"
- "testkit.luau"
- "scripts/mock/**"

jobs:
Main:
runs-on: ${{ matrix.runner-os }}
name: ${{ matrix.name }}
env:
GH_TOKEN: ${{ github.token }}
strategy:
fail-fast: false
matrix:
Expand All @@ -38,20 +38,26 @@ jobs:

steps:
- uses: CompeyDev/[email protected]
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Install Toolchain
run: rokit install --no-trust-check

- name: Fetch diff
id: fetch_diff
shell: bash
- name: Fetch Diff
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "diff=(gh pr diff ${{ github.event.pull_request.number }})" >> .diff
else
echo "diff=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }} --header 'Accept: application/vnd.github.v3.diff')" >> .diff
fi
case '${{ github.event_name }}' in
push)
firstCommit='${{ github.event.commits[0].id }}'
lastCommit='${{ github.event.commits[-1].id }}'
;;
pull_request)
firstCommit='${{ github.event.base_ref }}'
lastCommit='${{ github.event.head_ref }}'
;;
esac
echo "diff=$(git diff --name-only --diff-filter=d "${firstCommit}~1" "${lastCommit}")" >> .diff
- name: Run test runner
run: lune run scripts/test_runner
2 changes: 2 additions & 0 deletions scripts/diff_reader.luau
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ local LIB_FILENAME_BLACKLIST = table.freeze({
local GMATCH = string.gmatch
local diff_reader = {}

print(DEFAULT_DIFF)

function diff_reader.libs(diff: string?): ({ string }, { [string]: boolean })
local diff = diff or DEFAULT_DIFF
local changed_array = {}
Expand Down

0 comments on commit 8d87a59

Please sign in to comment.