diff --git a/.github/workflows/ok-to-test.yml b/.github/workflows/ok-to-test.yml
new file mode 100644
index 0000000..4af96b6
--- /dev/null
+++ b/.github/workflows/ok-to-test.yml
@@ -0,0 +1,34 @@
+# If someone with write access comments "/ok-to-test" on a pull request, emit a repository_dispatch event
+name: Ok To Test
+
+on:
+ issue_comment:
+ types: [created]
+
+jobs:
+ ok-to-test:
+ runs-on: ubuntu-latest
+ # Only run for PRs, not issue comments
+ if: ${{ github.event.issue.pull_request }}
+ steps:
+ # Generate a GitHub App installation access token from an App ID and private key
+ # To create a new GitHub App:
+ # https://developer.github.com/apps/building-github-apps/creating-a-github-app/
+ # See app.yml for an example app manifest
+ - name: Generate token
+ id: generate_token
+ uses: tibdex/github-app-token@v1
+ with:
+ app_id: ${{ secrets.APP_ID }}
+ private_key: ${{ secrets.PRIVATE_KEY }}
+
+ - name: Slash Command Dispatch
+ uses: peter-evans/slash-command-dispatch@v1
+ env:
+ TOKEN: ${{ steps.generate_token.outputs.token }}
+ with:
+ token: ${{ secrets.PAT }} # PAT or OAuth token will also work
+ issue-type: pull-request
+ commands: ok-to-test
+ named-args: true
+ permission: write
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index cdf92b2..408af12 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -1,22 +1,21 @@
-name: tests
-
-on:
+on:
pull_request:
- types:
- - opened
- - synchronize
- - reopened
+ repository_dispatch:
+ types: [ok-to-test-command]
+
+name: tests
jobs:
- tests:
+ tests-trusted:
runs-on: ubuntu-latest
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
steps:
# Checkout repo & install Python
- name: Check out repository
uses: actions/checkout@v2
with:
- # disable shallow clones for better sonarcloud accuracy
- fetch-depth: 0
+ # disable shallow clones for better sonarcloud accuracy
+ fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
@@ -61,3 +60,91 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+
+ # Repo owner has commented /ok-to-test on a (fork-based) pull request
+ integration-fork:
+ runs-on: ubuntu-latest
+ if: github.event_name == 'repository_dispatch' &&
+ github.event.client_payload.slash_command.sha != '' &&
+ contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha)
+ steps:
+ # Checkout repo & install Python
+ - name: Check out repository
+ uses: actions/checkout@v2
+ with:
+ # disable shallow clones for better sonarcloud accuracy
+ fetch-depth: 0
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.9
+ # Install & configure Poetry
+ - name: Install Poetry
+ uses: snok/install-poetry@v1
+ with:
+ virtualenvs-create: true
+ virtualenvs-in-project: true
+ installer-parallel: true
+ # Load cached venv
+ - name: Load cached venv
+ id: cached-poetry-dependencies
+ uses: actions/cache@v2
+ with:
+ path: .venv
+ key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
+ # Install dependencies if no cache
+ - name: Install dependencies
+ if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
+ run: poetry install --no-interaction --no-root
+ # Install package if needed
+ - name: Install package
+ run: poetry install --no-interaction
+ # Run tests
+ - name: Run tests
+ run: |
+ source .venv/bin/activate
+ pytest -v --cov --junitxml=pytest.xml
+ coverage xml -i
+ sed -i 's/\/home\/runner\/work\/tembo-core\/tembo-core\///g' coverage.xml
+ sed -i 's/\/home\/runner\/work\/tembo-core\/tembo-core\///g' pytest.xml
+ # Run linting
+ - name: Run prospector linting
+ run: |
+ source .venv/bin/activate
+ prospector "./tembo"
+ # Upload to sonarcloud
+ - name: SonarCloud Scan
+ uses: sonarsource/sonarcloud-github-action@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+
+ # Update check run called "integration-fork"
+ - uses: actions/github-script@v1
+ id: update-check-run
+ if: ${{ always() }}
+ env:
+ number: ${{ github.event.client_payload.pull_request.number }}
+ job: ${{ github.job }}
+ # Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run
+ conclusion: ${{ job.status }}
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ const { data: pull } = await github.pulls.get({
+ ...context.repo,
+ pull_number: process.env.number
+ });
+ const ref = pull.head.sha;
+ const { data: checks } = await github.checks.listForRef({
+ ...context.repo,
+ ref
+ });
+ const check = checks.check_runs.filter(c => c.name === process.env.job);
+ const { data: result } = await github.checks.update({
+ ...context.repo,
+ check_run_id: check[0].id,
+ status: 'completed',
+ conclusion: process.env.conclusion
+ });
+ return result;
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ac84db..7e4d2ec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,9 +3,26 @@
All notable changes to this project will be documented in this file.
+## [v1.0.3](https://github.com/tembo-pages/tembo-core/commits/v1.0.3) - 2021-11-23
+[Compare with v1.0.2](https://github.com/tembo-pages/tembo-core/compare/v1.0.2..v1.0.3)
+
+### Documentation
+
+- Update changelog ([f33f21](https://github.com/tembo-pages/tembo-core/commit/f33f215c7ef563dbddfcfde3818f1bfd0d1547a2))
+- Update changelog ([d84150](https://github.com/tembo-pages/tembo-core/commit/d8415067730e1310a426f6dd97304a436097760a))
+
+### Miscellaneous Tasks
+
+- Update duties.py ([d9e13b](https://github.com/tembo-pages/tembo-core/commit/d9e13b5c351d5be7c1f1dd60cf389b62d63ecd5b))
+
## [v1.0.2](https://github.com/tembo-pages/tembo-core/commits/v1.0.2) - 2021-11-23
[Compare with v1.0.1](https://github.com/tembo-pages/tembo-core/compare/v1.0.1..v1.0.2)
+### Documentation
+
+- Update CHANGELOG.md ([2b5632](https://github.com/tembo-pages/tembo-core/commit/2b5632955a0090e94d353bd407955371463b9416))
+- Update license reference ([e17882](https://github.com/tembo-pages/tembo-core/commit/e17882549a209955dbf6ab2c3582b13db4df4897))
+
### Features
- Add garbage ([b49d77](https://github.com/tembo-pages/tembo-core/commit/b49d776712737deaa1aeb86dd40230c099198d5a))
@@ -15,6 +32,8 @@ All notable changes to this project will be documented in this file.
- Prepare release v1.0.2 ([e29ae6](https://github.com/tembo-pages/tembo-core/commit/e29ae6dadb1ca419d536db18f34d9d249012cc25))
- Update cliff.toml ([7ee36f](https://github.com/tembo-pages/tembo-core/commit/7ee36f28b5160251c37085744166c2a5b1e695e4))
- Update duties.py with latest changelog duty ([f6f2fe](https://github.com/tembo-pages/tembo-core/commit/f6f2fe07b61e8fa8bd812bbc63a51d3f9705a448))
+- Update cliff.toml & duties.py ([8c1d76](https://github.com/tembo-pages/tembo-core/commit/8c1d7632dded4f221c61d942b548c1552f5b8292))
+
## [v1.0.1](https://github.com/tembo-pages/tembo-core/commits/v1.0.1) - 2021-11-21
[Compare with v1.0.0](https://github.com/tembo-pages/tembo-core/compare/v1.0.0..v1.0.1)
diff --git a/duties.py b/duties.py
index 581ad61..1dc6f7c 100644
--- a/duties.py
+++ b/duties.py
@@ -140,6 +140,10 @@ def release(ctx, version: str = "patch") -> None:
print(ctx.run(["duty", "bump", f"version={version}"]))
ctx.run(["duty", "build"])
ctx.run(["duty", "export"])
+ print(
+ "✔ Check generated files. Run `duty changelog planned_release= previous_release=` and `duty publish password=`"
+ " when ready to publish."
+ )
@duty