diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9b838da08b2..152b2b77ef9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,33 +6,44 @@ on: branches: [ master ] jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build Package - run: | - CHANGED_FILES=($(git diff --name-only --diff-filter=d $THE_LAST_COMMIT HEAD)) - for FILE in $CHANGED_FILES; do - if [[ $(basename $FILE) == "PKGBUILD" ]]; then - docker build -t builder -f travis/Dockerfile $(dirname $FILE) - docker run --rm builder - fi - done pkgcheck: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: 0 + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pkgcheck-arch --user + pip install pkgcheck-arch - name: Check Styling run: | - COMMIT_RANGE=($(git diff --name-only --diff-filter=d $(git log -2 --format=%H | tr '\n' ' '))) - CHANGED_FILES=($(git diff --name-only $COMMIT_RANGE)) - for FILE in $CHANGED_FILES; do + CHANGED_FILES=($(git diff --name-only --diff-filter=ACMRT origin/${{ github.event.pull_request.base.ref }}...${{ github.event.pull_request.head.sha }} | tr '\n' ' ')) + for FILE in "${CHANGED_FILES[@]}"; do if [[ $(basename $FILE) == "PKGBUILD" ]]; then + echo "Validating $FILE..." pkgcheck $FILE fi done + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + fetch-depth: 0 + + - name: Build Package + run: | + CHANGED_FILES=($(git diff --name-only --diff-filter=ACMRT origin/${{ github.event.pull_request.base.ref }}...${{ github.event.pull_request.head.sha }} | tr '\n' ' ')) + for FILE in "${CHANGED_FILES[@]}"; do + if [[ $(basename $FILE) == "PKGBUILD" ]]; then + echo "Building $FILE..." + docker build --load -t builder -f travis/Dockerfile $(dirname $FILE) + docker run --rm builder + fi + done