This repository has been archived by the owner on Oct 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from comigor/beta
Promote 6.17.1-beta.1 to master
- Loading branch information
Showing
115 changed files
with
12,302 additions
and
2,695 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**Make sure you're opening this pull request pointing to beta branch!** | ||
|
||
## What does this PR do/solve? |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM makocchi/alpine-git-curl-jq | ||
|
||
ENV OQ_VERSION 1.1.0 | ||
RUN curl -L https://github.com/Blacksmoke16/oq/releases/download/v${OQ_VERSION}/oq-v${OQ_VERSION}-linux-x86_64 > /usr/local/bin/oq \ | ||
&& chmod +x /usr/local/bin/oq | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Check version and changelog" | ||
description: "Make sure the version is bumped and it has a changelog entry" | ||
inputs: | ||
repo_token: | ||
description: "Access token for sending errors as a PR message" | ||
required: false | ||
default: "" | ||
base_ref: | ||
description: "GitHub base_ref" | ||
required: true | ||
default: "" | ||
outputs: | ||
package_version: | ||
description: "The package version" | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
args: | ||
- "${{ inputs.repo_token }}" | ||
- "${{ inputs.base_ref }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/ash | ||
|
||
cd "$GITHUB_WORKSPACE" | ||
|
||
REPO_TOKEN="$1" | ||
github_ref="$2" | ||
|
||
PR_HREF=$(cat "$GITHUB_EVENT_PATH" | jq -r '.pull_request._links.self.href') | ||
|
||
function send_message_and_bail { | ||
ERROR="$1" | ||
|
||
if [ ! -z "$REPO_TOKEN" ]; then | ||
jq -c -n --arg body "$ERROR" '{"event":"COMMENT", "body":$body}' > /tmp/payload.json | ||
curl -f -X POST \ | ||
-H 'Content-Type: application/json' \ | ||
-H "Authorization: Bearer $REPO_TOKEN" \ | ||
--data "@/tmp/payload.json" \ | ||
"$PR_HREF/reviews" -vv || true | ||
fi | ||
|
||
echo "------------------------------------------------" | ||
echo "$ERROR" | ||
echo "------------------------------------------------" | ||
exit 1 | ||
} | ||
|
||
# echo "PARAM GITHUB REF: $github_ref" | ||
# echo "GITHUB EVENT NAME: $GITHUB_EVENT_NAME" | ||
# echo "GITHUB REF: $GITHUB_REF" | ||
# echo "GITHUB BASE REF: $GITHUB_BASE_REF" | ||
# echo "GITHUB HEAD REF: $GITHUB_HEAD_REF" | ||
|
||
git fetch --prune --unshallow | ||
|
||
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then | ||
where="origin/$github_ref" | ||
else | ||
where=HEAD~$(jq '.commits | length' "${GITHUB_EVENT_PATH}") | ||
fi | ||
|
||
diff=$(git diff $where pubspec.yaml) | ||
|
||
echo "$diff" | grep -E '\+.*version' || { | ||
send_message_and_bail "You must bump the version on pubspec!" | ||
} | ||
|
||
package_version=$(cat pubspec.yaml | oq -i YAML -r '.version') | ||
|
||
# If are on master or beta | ||
if [ "$github_ref" = "master" ] || [ "$github_ref" = "refs/heads/master" ]; then | ||
echo "$package_version" | grep "beta" && { | ||
send_message_and_bail "You can't merge a \"beta\" version on \`master\` branch!" | ||
} | ||
elif [ "$github_ref" = "beta" ] || [ "$github_ref" = "refs/heads/beta" ]; then | ||
echo "$package_version" | grep "beta" || { | ||
send_message_and_bail "You can only merge a \"beta\" version on \`beta\` branch!" | ||
} | ||
fi | ||
|
||
cat CHANGELOG.md | grep -q "$package_version" || { | ||
send_message_and_bail "Version \`$package_version\` not found on CHANGELOG!" | ||
} | ||
|
||
echo "::set-output name=package_version::$package_version" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM cirrusci/flutter | ||
|
||
USER root | ||
|
||
RUN apt update && apt install -y jq | ||
|
||
ADD entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Run linter and tests on a Dart package" | ||
description: "Run linter and tests on a Dart package" | ||
inputs: | ||
repo_token: | ||
description: "Access token for sending errors as a PR message" | ||
required: false | ||
is_flutter: | ||
description: "Run everything on Flutter context instead of Dart's" | ||
required: false | ||
default: "false" | ||
disable_linter: | ||
description: "Disable dry-run dartfmt linter check" | ||
required: false | ||
default: "false" | ||
disable_analyzer: | ||
description: "Disable dartanalyzer" | ||
required: false | ||
default: "false" | ||
disable_tests: | ||
description: "Disable pub run test" | ||
required: false | ||
default: "false" | ||
exclude_regex: | ||
description: "Regex to be used to exclude folders when looking for pubspec.yaml files" | ||
required: false | ||
default: "__________________" | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
args: | ||
- "${{ inputs.repo_token }}" | ||
- "${{ inputs.is_flutter }}" | ||
- "${{ inputs.disable_linter }}" | ||
- "${{ inputs.disable_analyzer }}" | ||
- "${{ inputs.disable_tests }}" | ||
- "${{ inputs.exclude_regex }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
REPO_TOKEN="$1" | ||
DTA_IS_FLUTTER="$2" | ||
DTA_DISABLE_LINTER="$3" | ||
DTA_DISABLE_ANALYZER="$4" | ||
DTA_DISABLE_TESTS="$5" | ||
DTA_EXCLUDE_REGEX="$6" | ||
|
||
echo "DTA_IS_FLUTTER=$DTA_IS_FLUTTER" | ||
echo "DTA_DISABLE_LINTER=$DTA_DISABLE_LINTER" | ||
echo "DTA_DISABLE_ANALYZER=$DTA_DISABLE_ANALYZER" | ||
echo "DTA_DISABLE_TESTS=$DTA_DISABLE_TESTS" | ||
echo "DTA_EXCLUDE_REGEX=$DTA_EXCLUDE_REGEX" | ||
|
||
cd "$GITHUB_WORKSPACE" | ||
|
||
PR_HREF=$(cat "$GITHUB_EVENT_PATH" | jq -r '.pull_request._links.self.href') | ||
|
||
function send_message_and_bail { | ||
ERROR="$1" | ||
DETAIL="$2" | ||
|
||
if [ ! -z "$REPO_TOKEN" ]; then | ||
BODY=$(cat <<EOF | ||
$ERROR | ||
<details> | ||
<pre> | ||
$DETAIL | ||
</pre> | ||
</details> | ||
EOF | ||
) | ||
|
||
jq -c -n --arg body "$BODY" '{"event":"COMMENT", "body":$body}' > /tmp/payload.json | ||
curl -f -X POST \ | ||
-H 'Content-Type: application/json' \ | ||
-H "Authorization: Bearer $REPO_TOKEN" \ | ||
--data "@/tmp/payload.json" \ | ||
"$PR_HREF/reviews" -vv || true | ||
fi | ||
|
||
echo "------------------------------------------------" | ||
echo "$ERROR" | ||
echo "$DETAIL" | ||
echo "------------------------------------------------" | ||
exit 1 | ||
} | ||
|
||
for ppath in $(find . -name pubspec.yaml | grep -ve "$DTA_EXCLUDE_REGEX"); do | ||
echo "=== On $ppath ===" | ||
cd $(dirname "$ppath"); | ||
|
||
echo "=== Downloading dependencies ===" | ||
if [ "$DTA_IS_FLUTTER" = "false" ]; then | ||
pub get | ||
else | ||
flutter pub get | ||
fi | ||
|
||
if [ "$DTA_DISABLE_LINTER" = "false" ]; then | ||
echo "=== Running linter ===" | ||
OUTPUT=$(dartfmt -n . --set-exit-if-changed 2>&1) | ||
|
||
if [ $? -ne 0 ]; then | ||
send_message_and_bail "Linter has failed!" "$OUTPUT" | ||
fi | ||
fi | ||
|
||
if [ "$DTA_DISABLE_ANALYZER" = "false" ]; then | ||
echo "=== Running analyzer ===" | ||
OUTPUT=$(dartanalyzer --fatal-infos --fatal-warnings . 2>&1) || send_message_and_bail "Analyzer has failed!" "$OUTPUT" | ||
fi | ||
|
||
[ -d "test" ] && { | ||
if [ "$DTA_DISABLE_TESTS" = "false" ]; then | ||
echo "=== Running tests ===" | ||
if [ "$DTA_IS_FLUTTER" = "false" ]; then | ||
OUTPUT=$(pub run test --no-color -r expanded -- test/query_generator/aliases/alias_on_leaves_test.dart 2>&1) || send_message_and_bail "Tests failed!" "$OUTPUT" | ||
else | ||
OUTPUT=$(flutter test 2>&1) || send_message_and_bail "Tests failed!" "$OUTPUT" | ||
fi | ||
fi | ||
} | ||
|
||
# Go back | ||
cd - | ||
done |
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- beta | ||
|
||
name: CI | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@master | ||
- name: Run tests | ||
uses: comigor/actions/dart-test@master | ||
env: | ||
DTA_EXCLUDE_REGEX: example | ||
create-tag-and-release: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' | ||
steps: | ||
- uses: actions/checkout@master | ||
- id: check_version_and_changelog | ||
name: Check if version on pubspec.yaml was changed and if there's an entry for this new version on CHANGELOG | ||
uses: ./.github/actions/check-version-and-changelog | ||
with: | ||
base_ref: "${{ github.ref }}" | ||
- name: Push tag | ||
uses: anothrNick/github-tag-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CUSTOM_TAG: "v${{ steps.check_version_and_changelog.outputs.package_version }}" | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: "v${{ steps.check_version_and_changelog.outputs.package_version }}" | ||
release_name: "Release v${{ steps.check_version_and_changelog.outputs.package_version }}" | ||
deploy: | ||
needs: create-tag-and-release | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Publish to pub.dev | ||
uses: comigor/actions/pub-publish@master | ||
env: | ||
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }} |
Oops, something went wrong.