Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 58 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Checks every pull request and push to dev and main: the pull request title,
# the lint, the build and the Docker image. The gate `passed` ("CI passed") is
# the only check that the rules for dev need to require. Pushes to main stay
# covered because the Deploy workflow publishes after CI for them. Runs also when a pull
# request is edited, so that the title check follows the title; all jobs run
# then, as a run that skipped the build would report "CI passed" for the
# commit. CI also runs the tests (with coverage, reported to Codecov), audits
# the production dependencies and scans the image for known vulnerabilities.
# Checks every pull request and push to dev: the pull request title, the
# lint, the tests (with coverage, reported to Codecov), the build, an audit of
# the production dependencies, and the Docker image and its scan for known
# vulnerabilities. The gate `passed` ("CI passed") is the only check that the
# rules for dev need to require. The Release workflow requires a successful
# run for the push of the release commit to dev; main needs no runs, as it
# only moves forward to commits of dev that are released. Runs also when a
# pull request is edited, so that the title check follows the title; all jobs
# run then, as a run that skipped the build would report "CI passed" for the
# commit.
name: CI

on:
pull_request:
types: [opened, synchronize, reopened, edited]
push:
branches: [dev, main]
branches: [dev]

permissions:
contents: read
Expand All @@ -22,10 +24,11 @@ permissions:
# wait, so that a run on the same commit never leaves a cancelled, failed
# `CI passed` (see "Cancelled runs" in `actions/gate/README.md` of
# `elixir-cloud-aai/.github`). Runs for pushes get their own group, per
# branch and commit (a commit can be pushed to `dev` and `main`), so that
# none is dropped. Runs for edits that leave the title unchanged (e.g. of
# the description, also by bots) share a group of their own, so that they
# don't wait for the run for the pull request's commit
# branch and commit, and aren't cancelled, as the Release workflow needs the
# run of the release commit, also when other commits follow it quickly. Runs
# for edits that leave the title unchanged (e.g. of the description, also by
# bots) share a group of their own, so that they don't wait for the run for
# the pull request's commit
concurrency:
group: >-
ci-${{
Expand Down Expand Up @@ -60,7 +63,8 @@ jobs:

# Lints all JavaScript and TypeScript sources with ESLint (Next.js's
# recommended flat config with typescript-eslint, plus the project's rules
# in `eslint.config.js`); fails on errors and warnings
# in `eslint.config.js`); fails on errors and warnings. Also checks the
# curated release notes in `docs/releases/`
lint:
name: Lint
runs-on: ubuntu-latest
Expand All @@ -83,6 +87,46 @@ jobs:
- name: Lint
run: npm run lint

# The release workflow publishes the curated notes as they are and checks
# their format only after the tag is pushed: check them here, with the
# checker of the action that `release.yml` pins (keep the commit in
# sync), so that a release-prep pull request fails instead. Once
# `package.json` has a release version (`YYYY.M.MICRO`), its notes must
# exist, so that a pull request that sets a new version brings them
# (`0.1.0`, from before the first release, has none)
- name: Check release notes
env:
CHECKER_SHA: 31f22fccc1f3c597ed7c1d1f75b2f85522155348 # v1.1.0
run: |
# Dependabot bumps only the `uses:` pins of `release.yml`: the
# checker here and in the README's pre-tag block must follow them
pins="$(grep -ohE 'publish-release@[0-9a-f]{40}' .github/workflows/release.yml | sort -u)"
if [[ "${pins}" != "publish-release@${CHECKER_SHA}" ]]; then
echo "::error file=.github/workflows/ci.yml::The checker (${CHECKER_SHA}) doesn't match the publish-release pins of release.yml: ${pins//$'\n'/, }"
exit 1
fi
if ! grep -qF "elixir-cloud-aai/.github/${CHECKER_SHA}/actions/publish-release/publish.py" README.md; then
echo "::error file=README.md::The pre-tag block of README.md doesn't use the checker ${CHECKER_SHA}"
exit 1
fi
version="$(jq -r .version package.json)"
if [[ "v${version}" =~ ^v20[0-9]{2}\.([1-9]|1[0-2])\.(0|[1-9][0-9]*)$ \
&& ! -f "docs/releases/${version}.md" ]]; then
echo "::error file=package.json::No release notes docs/releases/${version}.md for version ${version}"
exit 1
fi
shopt -s nullglob
notes=(docs/releases/*.md)
if (( ${#notes[@]} == 0 )); then
echo "No release notes yet"
exit 0
fi
curl -fsSL "https://raw.githubusercontent.com/elixir-cloud-aai/.github/${CHECKER_SHA}/actions/publish-release/publish.py" \
-o "${RUNNER_TEMP}/publish.py"
for file in "${notes[@]}"; do
python3 -I "${RUNNER_TEMP}/publish.py" check "${file}"
done

test:
name: Test
runs-on: ubuntu-latest
Expand Down
140 changes: 0 additions & 140 deletions .github/workflows/deploy.yml

This file was deleted.

Loading