Skip to content

Commit

Permalink
feat(ci): Add builds for preview binaries (#1777)
Browse files Browse the repository at this point in the history
* feat(ci): Add builds for preview binaries

* chore(ci): Update actions

* chore(ci): Only run the CI workflow on PR, merge_group, and push-to-main

* document decision

* Remove seemingly unnecessary string quotes
  • Loading branch information
phated committed Mar 22, 2023
1 parent ae21466 commit d512c5a
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 107 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/build-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,28 @@ on:
workflow_dispatch:
inputs:
os:
description: "Operating system to run CI on"
description: Operating system to run CI on
type: choice
required: true
default: "ubuntu-latest"
type: choice
options:
- ubuntu-latest
- macos-latest
- windows-latest
ref:
description: Git reference to checkout
type: string
required: false
workflow_call:
inputs:
os:
description: Operating system to run CI on
type: string
required: true
ref:
description: Git reference to checkout
type: string
required: false

jobs:
build:
Expand All @@ -29,6 +38,8 @@ jobs:
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}

- name: Setup node.js
uses: actions/setup-node@v3.6.0
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/build-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,28 @@ on:
workflow_dispatch:
inputs:
os:
description: "Operating system to run CI on"
description: Operating system to run CI on
type: choice
required: true
default: "ubuntu-latest"
type: choice
options:
- ubuntu-latest
- macos-latest
- windows-latest
ref:
description: Git reference to checkout
type: string
required: false
workflow_call:
inputs:
os:
description: Operating system to run CI on
type: string
required: true
ref:
description: Git reference to checkout
type: string
required: false

jobs:
build:
Expand All @@ -29,6 +38,8 @@ jobs:
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}

- name: Setup node.js
uses: actions/setup-node@v3.6.0
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Grain CI Workflow

on: [push, pull_request]
# This is to avoid unnecessary runs.
# e.g. push AND pull_request against a PR or push against a tag from workflow runs
# If you need CI to run, you can open a Draft PR to trigger the CI.
on:
push:
branches: [main]
pull_request:
merge_group:

# This will cancel previous runs when a branch or PR is updated
concurrency:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow assumes that a `grain-linux-x64` binary was uploaded earlier within the same Action run.
# It downloads the binary, regenerates the documentation for the project, and pushes it to the ref that was checked out.
# Note: the `ref` should always be a branch for successful pushes!
name: Generate documentation

on:
workflow_call:
inputs:
ref:
description: Git reference to checkout
type: string
required: false
secrets:
PUSH_TOKEN:
description: Token used to push back to repository
required: true

jobs:
generate-docs:
name: Generate documentation
runs-on: ubuntu-latest
steps:
- name: Setup bot user
run: |
git config --global user.email "bot@grain-lang.org"
git config --global user.name "Grain Bot"
- name: Checkout project
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
token: ${{ secrets.PUSH_TOKEN }}

- name: Fetch linux binary
uses: actions/download-artifact@v3
with:
name: grain-linux-x64

- name: Untar download
run: |
tar -xvf grain.tar
- name: Regenerate documentation
run: |
./grain doc stdlib -o stdlib --current-version=$(./grain -v)
git add stdlib
git commit -m 'chore(stdlib): Regenerate markdown documentation'
git push
Loading

0 comments on commit d512c5a

Please sign in to comment.