diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml new file mode 100644 index 0000000..d9885ae --- /dev/null +++ b/.github/workflows/ci-main.yml @@ -0,0 +1,75 @@ +name: ci + +on: + schedule: + - cron: "0 */4 * * *" + +jobs: + setup: + runs-on: ubuntu-latest + if: github.repository == 'simulationcraft/simc-profile' && github.ref_name == github.event.repository.default_branch + + outputs: + cache-key: simc-clang++-18-cpp17-${{ env.SHA }} + cache-hit: ${{ steps.restore_cache.outputs.cache-hit }} + + steps: + - uses: actions/checkout@v6 + with: + repository: simulationcraft/simc + path: simc-profile/simc/ + + - name: cache_key + shell: bash + run: | + cd simc-profile/simc/ + echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV + cd ../.. + + - uses: actions/cache/restore@v5 + id: restore_cache + continue-on-error: true + with: + path: simc-profile/simc/b/ninja/simc + key: simc-clang++-18-cpp17-${{ env.SHA }} + lookup-only: true + + ci: + runs-on: ubuntu-latest + needs: setup + if: ${{ !fromJson( needs.setup.outputs.cache-hit ) }} + + steps: + - uses: actions/checkout@v6 + if: ${{ + + - name: validate_python_main + run: | + find ${{ runner.workspace }}/simc-profile/profiles -type f \ + | xargs python ${{ runner.workspace }}/simc-profile/scripts/validate.py \ + --validate + + - name: validate_seasonal_python_main + run: | + find ${{ runner.workspace }}/simc-profile/profiles -type f \ + | xargs python ${{ runner.workspace }}/simc-profile/scripts/validate.py \ + --validate-seasonal + + - uses: ./.github/workflows/build + id: build + with: + cache-key: ${{ fromJson( needs.setup.outputs.cache-key }} + + - name: validate_simc_main + run: | + find ${{ runner.workspace }}/simc-profile/profiles -type f \ + | xargs python ${{ runner.workspace }}/simc-profile/scripts/execute.py \ + -b ${{ runner.workspace }}/simc-profile/simc-profile/simc/b/ninja/simc \ + --save . + + - name: execute_simc_main + run: | + find ${{ runner.workspace }}/simc-profile/profiles -type f \ + | xargs python ${{ runner.workspace }}/simc-profile/scripts/execute.py \ + -b ${{ runner.workspace }}/simc-profile/simc-profile/simc/b/ninja/simc \ + --execute . diff --git a/.github/workflows/ci-pullrequest.yml b/.github/workflows/ci-pullrequest.yml new file mode 100644 index 0000000..b8eb4c8 --- /dev/null +++ b/.github/workflows/ci-pullrequest.yml @@ -0,0 +1,44 @@ +name: ci-pullrequest + +on: + pull_request + +jobs: + CI: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 2 + + - name: modified_files + run: | + files=$(git diff --diff-filter=AM --no-commit-id --name-only HEAD~1 -- '***.simc' | xargs) + echo "MODIFIED_FILES=$files" >> $GITHUB_ENV + + - name: validate_python + run: | + python ${{ runner.workspace }}/simc-profile/scripts/validate.py \ + ${{ env.MODIFIED_FILES }} --validate + + - name: validate_seasonal_python_pr + if: github.event_name == 'pull_request' + run: | + python ${{ runner.workspace }}/simc-profile/scripts/validate.py \ + ${{ env.MODIFIED_FILES }} --validate-seasonal + + - uses: ./.github/workflows/setup_simc + id: setup + + - name: validate_simc_pr + run: | + python ${{ runner.workspace }}/simc-profile/scripts/execute.py \ + ${{ env.MODIFIED_FILES }} -b ${{ runner.workspace }}/simc-profile/simc-profile/simc/b/ninja/simc \ + --save . + + - name: execute_simc_pr + run: | + python ${{ runner.workspace }}/simc-profile/scripts/execute.py \ + ${{ env.MODIFIED_FILES }} -b ${{ runner.workspace }}/simc-profile/simc-profile/simc/b/ninja/simc \ + --execute . diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 3539e5c..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: CI - -on: [pull_request, push] - -jobs: - CI: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 2 - - - name: modified_files - run: | - files=$(git diff --diff-filter=AM --no-commit-id --name-only HEAD~1 -- '***.simc' | xargs) - echo "MODIFIED_FILES=$files" >> $GITHUB_ENV - - - name: validate_python_pr - if: github.event_name == 'pull_request' - run: | - python ${{ runner.workspace }}/simc-profile/scripts/validate.py \ - ${{ env.MODIFIED_FILES }} --validate - - - name: validate_python_main - if: github.event_name == 'push' && github.repository == 'simulationcraft/simc-profile' && github.ref_name == github.event.repository.default_branch - run: | - find ${{ runner.workspace }}/simc-profile/profiles -type f \ - | xargs python ${{ runner.workspace }}/simc-profile/scripts/validate.py --validate - - - name: validate_seasonal_python_pr - if: github.event_name == 'pull_request' - run: | - python ${{ runner.workspace }}/simc-profile/scripts/validate.py \ - ${{ env.MODIFIED_FILES }} --validate-seasonal - - - name: validate_seasonal_python_main - if: github.event_name == 'push' && github.repository == 'simulationcraft/simc-profile' && github.ref_name == github.event.repository.default_branch - run: | - find ${{ runner.workspace }}/simc-profile/profiles -type f \ - | xargs python ${{ runner.workspace }}/simc-profile/scripts/validate.py --validate-seasonal - - - uses: ./.github/workflows/setup_simc - id: setup - - - name: validate_simc_pr - if: github.event_name == 'pull_request' - run: | - python ${{ runner.workspace }}/simc-profile/scripts/execute.py \ - ${{ env.MODIFIED_FILES }} -b ${{ runner.workspace }}/simc-profile/simc-profile/simc/b/ninja/simc \ - --save . - - - name: execute_simc_pr - if: github.event_name == 'pull_request' - run: | - python ${{ runner.workspace }}/simc-profile/scripts/execute.py \ - ${{ env.MODIFIED_FILES }} -b ${{ runner.workspace }}/simc-profile/simc-profile/simc/b/ninja/simc \ - --execute . - - - name: validate_simc_main - if: github.event_name == 'push' && github.repository == 'simulationcraft/simc-profile' && github.ref_name == github.event.repository.default_branch - run: | - find ${{ runner.workspace }}/simc-profile/profiles -type f \ - | xargs python ${{ runner.workspace }}/simc-profile/scripts/execute.py \ - -b ${{ runner.workspace }}/simc-profile/simc-profile/simc/b/ninja/simc \ - --save . - - - name: execute_simc_main - if: github.event_name == 'push' && github.repository == 'simulationcraft/simc-profile' && github.ref_name == github.event.repository.default_branch - run: | - find ${{ runner.workspace }}/simc-profile/profiles -type f \ - | xargs python ${{ runner.workspace }}/simc-profile/scripts/execute.py \ - -b ${{ runner.workspace }}/simc-profile/simc-profile/simc/b/ninja/simc \ - --execute .