Skip to content

Commit

Permalink
fix: auto release (#957)
Browse files Browse the repository at this point in the history
  • Loading branch information
amitksingh1490 committed Jan 16, 2024
1 parent fe4ed2d commit 5df19ef
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
49 changes: 33 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
types: [opened, reopened, synchronize]
pull_request_target:
types: [opened, reopened, synchronize]
release:
types: [published]
permissions:
contents: read
jobs:
Expand Down Expand Up @@ -51,7 +49,7 @@ jobs:

test:
name: Run Tests
if: (github.event_name == 'pull_request') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && github.event.action == 'published')
if: (github.event_name == 'pull_request') || (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -88,13 +86,13 @@ jobs:

format:
name: Run Formatter and Lint Check
if: (github.event_name == 'pull_request') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && github.event.action == 'published')
if: (github.event_name == 'pull_request') || (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
node-version: "20.11.0"
- name: Install Prettier
run: npm install --global prettier
- name: Install Nightly Toolchain
Expand All @@ -116,7 +114,7 @@ jobs:

draft_release:
name: Draft Release
if: (github.event_name == 'pull_request_target') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && github.event.action == 'published')
if: (github.event_name == 'pull_request_target') || (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -145,7 +143,7 @@ jobs:
release:
name: Release
needs: [test, format, draft_release, check_if_build, compile_wasm]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && (needs.check_if_build.outputs.check_if_build == 'true') || (github.event_name == 'release' && github.event.action == 'published')
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && (needs.check_if_build.outputs.check_if_build == 'true')
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -243,7 +241,7 @@ jobs:
pull-requests: write
env:
GITHUB_TOKEN: ${{secrets.GITHUBTOKEN}}
APP_VERSION: ${{ (github.event_name == 'release' && github.event.action == 'published') && github.event.release.tag_name || needs.draft_release.outputs.create_release_name }}
APP_VERSION: ${{ needs.draft_release.outputs.create_release_name }}

steps:
- name: Checkout Current Branch (Fast)
Expand All @@ -257,7 +255,7 @@ jobs:

- name: Build
env:
APP_VERSION: ${{ (github.event_name == 'release' && github.event.action == 'published') && github.event.release.tag_name || needs.draft_release.outputs.create_release_name}}
APP_VERSION: ${{ needs.draft_release.outputs.create_release_name}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
uses: actions-rs/cargo@v1
with:
Expand All @@ -266,28 +264,28 @@ jobs:
args: --release --target ${{ matrix.target }}

- name: Install Node.js
if: github.event_name == 'release' && github.event.action == 'published'
if: (contains(github.event.head_commit.message, 'feat:') || contains(github.event.head_commit.message, 'fix:')) && (github.event_name == 'push' && github.ref == 'refs/heads/main')
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20.11.0
registry-url: https://registry.npmjs.org

- name: Install dependencies
if: github.event_name == 'release' && github.event.action == 'published'
if: (contains(github.event.head_commit.message, 'feat:') || contains(github.event.head_commit.message, 'fix:')) && (github.event_name == 'push' && github.ref == 'refs/heads/main')
run: |
cd npm
npm install
- name: Run generate.js script
if: github.event_name == 'release' && github.event.action == 'published'
if: (contains(github.event.head_commit.message, 'feat:') || contains(github.event.head_commit.message, 'fix:')) && (github.event_name == 'push' && github.ref == 'refs/heads/main')
run: |
cd npm
npm run gen -- --target ${{matrix.target}} --version ${{ env.APP_VERSION }} --build ${{matrix.build}} --ext ${{ matrix.ext || '' }} --libc ${{ matrix.libc }}
- name: Setup .npmrc file to publish to npm
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > ~/.npmrc

- name: NPM Publish
if: github.event_name == 'release' && github.event.action == 'published'
if: (contains(github.event.head_commit.message, 'feat:') || contains(github.event.head_commit.message, 'fix:')) && (github.event_name == 'push' && github.ref == 'refs/heads/main')
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
Expand All @@ -307,18 +305,37 @@ jobs:
release_id: ${{ needs.draft_release.outputs.create_release_id }}
file: target/${{ matrix.target }}/release/tailcall-${{ matrix.target }}${{ matrix.ext }}
overwrite: true

semantic_release:
name: Semantic Release
if: (contains(github.event.head_commit.message, 'feat:') || contains(github.event.head_commit.message, 'fix:')) && (github.event_name == 'push' && github.ref == 'refs/heads/main')
needs: [draft_release, release]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APP_VERSION: ${{needs.draft_release.outputs.create_release_name }}
steps:
- name: Publish Release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.draft_release.outputs.create_release_id }}
publish_npm_root:
name: Publish NPM main package
needs: [draft_release, release]
if: github.event_name == 'release' && github.event.action == 'published'
if: (contains(github.event.head_commit.message, 'feat:') || contains(github.event.head_commit.message, 'fix:')) && (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- name: Checkout Current Branch (Fast)
uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20.11.0
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/blueprint/blueprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Type {
Type::ListType { of_type, .. } => of_type.name(),
}
}

/// checks if the type is nullable
pub fn is_nullable(&self) -> bool {
!match self {
Type::NamedType { non_null, .. } => *non_null,
Expand Down

1 comment on commit 5df19ef

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running 30s test @ http://localhost:8000/graphql

4 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev
Latency 6.35ms 2.65ms 29.72ms 69.07%
Req/Sec 3.96k 164.61 4.83k 89.67%

473487 requests in 30.01s, 2.37GB read

Requests/sec: 15775.25

Transfer/sec: 80.97MB

Please sign in to comment.