Skip to content

Commit 5b0ea9f

Browse files
committed
Add github actions for build and release
1 parent 8b8e63a commit 5b0ea9f

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

.github/workflows/release.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# CI that:
2+
#
3+
# * checks for a Git Tag that looks like a release
4+
# * creates a Github Release™ and fills in its text
5+
# * builds artifacts with cargo-dist (executable-zips, installers)
6+
# * uploads those artifacts to the Github Release™
7+
#
8+
# Note that the Github Release™ will be created before the artifacts,
9+
# so there will be a few minutes where the release has no artifacts
10+
# and then they will slowly trickle in, possibly failing. To make
11+
# this more pleasant we mark the release as a "draft" until all
12+
# artifacts have been successfully uploaded. This allows you to
13+
# choose what to do with partial successes and avoids spamming
14+
# anyone with notifications before the release is actually ready.
15+
name: Release
16+
17+
permissions:
18+
contents: write
19+
20+
# This task will run whenever you push a git tag that looks like a version
21+
# like "v1", "v1.2.0", "v0.1.0-prerelease01", "my-app-v1.0.0", etc.
22+
# The version will be roughly parsed as ({PACKAGE_NAME}-)?v{VERSION}, where
23+
# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION
24+
# must be a Cargo-style SemVer Version.
25+
#
26+
# If PACKAGE_NAME is specified, then we will create a Github Release™ for that
27+
# package (erroring out if it doesn't have the given version or isn't cargo-dist-able).
28+
#
29+
# If PACKAGE_NAME isn't specified, then we will create a Github Release™ for all
30+
# (cargo-dist-able) packages in the workspace with that version (this is mode is
31+
# intended for workspaces with only one dist-able package, or with all dist-able
32+
# packages versioned/released in lockstep).
33+
#
34+
# If you push multiple tags at once, separate instances of this workflow will
35+
# spin up, creating an independent Github Release™ for each one.
36+
#
37+
# If there's a prerelease-style suffix to the version then the Github Release™
38+
# will be marked as a prerelease.
39+
on:
40+
push:
41+
tags:
42+
- '*-?v[0-9]+*'
43+
44+
jobs:
45+
# Create the Github Release™ so the packages have something to be uploaded to
46+
create-release:
47+
runs-on: ubuntu-latest
48+
outputs:
49+
has-releases: ${{ steps.create-release.outputs.has-releases }}
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
steps:
53+
- uses: actions/checkout@v3
54+
- name: Install Rust toolchain
55+
uses: dtolnay/rust-toolchain@stable
56+
- name: Install Zig toolchain
57+
uses: korandoru/setup-zig@v1
58+
with:
59+
zig-version: 0.10.0
60+
- name: Install Cargo Lambda
61+
uses: jaxxstorm/action-install-gh-release@v1.9.0
62+
with:
63+
repo: cargo-lambda/cargo-lambda
64+
platform: linux # Other valid options: 'windows' or 'darwin'
65+
arch: x86_64 # Other valid options for linux: 'aarch64'
66+
- name: Build release
67+
run: cargo lambda build --release --output-format zip
68+
69+
- name: release
70+
uses: actions/create-release@v1
71+
id: create_release
72+
with:
73+
draft: false
74+
prerelease: false
75+
release_name: ${{ steps.version.outputs.version }}
76+
tag_name: ${{ github.ref }}
77+
env:
78+
GITHUB_TOKEN: ${{ github.token }}
79+
80+
- name: Upload query-metrics lambda
81+
uses: actions/upload-release-asset@v1
82+
env:
83+
GITHUB_TOKEN: ${{ github.token }}
84+
with:
85+
upload_url: ${{ steps.create_release.outputs.upload_url }}
86+
asset_path: ./target/lambda/query-metrics/bootstrap.zip
87+
asset_name: oxbow-lambda-bootstrap-${{ github.ref_name }}.zip
88+
asset_content_type: application/zip

.github/workflows/rust.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Install Rust toolchain
18+
uses: dtolnay/rust-toolchain@stable
19+
- name: Install Zig toolchain
20+
uses: korandoru/setup-zig@v1
21+
with:
22+
zig-version: 0.10.0
23+
- name: Install Cargo Lambda
24+
uses: jaxxstorm/action-install-gh-release@v1.9.0
25+
with:
26+
repo: cargo-lambda/cargo-lambda
27+
platform: linux # Other valid options: 'windows' or 'darwin'
28+
arch: x86_64 # Other valid options for linux: 'aarch64'
29+
# Add your build steps below
30+
- name: Build
31+
run: cargo lambda build
32+
- name: Run tests
33+
run: cargo test --verbose

0 commit comments

Comments
 (0)