1.3.2 #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI / Merge | |
on: | |
push: | |
branches: | |
- staging | |
- feature* | |
jobs: | |
check-lint: | |
name: "Check / Lint" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run linting | |
run: | | |
npm install | |
npm run lint | |
npm run lint-shell | |
check-test: | |
name: "Check / Test" | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/matrixai/github-runner | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run tests | |
run: | | |
nix develop .#ci --command bash -c $' | |
npm run prebuild --verbose | |
npm test -- --ci --coverage | |
' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: tmp/coverage/cobertura-coverage.xml | |
build-pull: | |
name: "Build / Pull Request" | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/staging' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create pull request | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
gh pr create \ | |
--head staging \ | |
--base master \ | |
--title "ci: merge staging to master" \ | |
--body "This is an automatic PR generated by the CI/CD pipeline. This will be automatically fast-forward merged if successful." \ | |
--assignee "@me" \ | |
--no-maintainer-edit || true | |
printf "Pipeline Attempt on $GITHUB_RUN_ID for $GITHUB_SHA\n\n$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ | |
| gh pr comment staging \ | |
--body-file - \ | |
--repo "$GITHUB_REPOSITORY" | |
integration-merge: | |
name: "Integration / Merge" | |
runs-on: ubuntu-latest | |
concurrency: | |
group: integration-merge | |
cancel-in-progress: true | |
needs: [check-lint, check-test, build-pull] | |
if: github.ref == 'refs/heads/staging' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Merge into master | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} | |
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} | |
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} | |
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }} | |
run: | | |
printf "Pipeline Succeeded on $GITHUB_RUN_ID for $GITHUB_SHA\n\n$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ | |
| gh pr comment staging \ | |
--body-file - \ | |
--repo "$GITHUB_REPOSITORY" | |
git checkout master | |
git merge --ff-only "$GITHUB_SHA" | |
git push origin master | |