mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-14 22:10:49 +00:00
chore: Use github actions CI and add release-please (#11)
This commit is contained in:
parent
69e3f8f7a4
commit
86743b28c1
@ -1,44 +0,0 @@
|
|||||||
version: 2.1
|
|
||||||
|
|
||||||
orbs:
|
|
||||||
docker: circleci/docker@1.5.0
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sqlite_connector_rust_tests:
|
|
||||||
docker:
|
|
||||||
- image: circleci/rust:latest
|
|
||||||
resource_class: xlarge
|
|
||||||
environment:
|
|
||||||
RUST_BACKTRACE: full
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- sqlite-connector01-{{ checksum "Cargo.lock" }}
|
|
||||||
- run: |
|
|
||||||
rustup toolchain install nightly-2021-05-21
|
|
||||||
rustup default nightly-2021-05-21
|
|
||||||
rustup override set nightly-2021-05-21
|
|
||||||
|
|
||||||
rustup component add rustfmt --toolchain nightly-2021-05-21
|
|
||||||
rustup component add clippy --toolchain nightly-2021-05-21
|
|
||||||
rustup target add wasm32-wasi
|
|
||||||
|
|
||||||
cargo install marine
|
|
||||||
|
|
||||||
cargo fmt --all -- --check --color always
|
|
||||||
cargo check -v --all-features
|
|
||||||
|
|
||||||
./build.sh
|
|
||||||
cargo test --release -v --all-features
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- ~/.cargo
|
|
||||||
- ~/.rustup
|
|
||||||
key: sqlite-connector01-{{ checksum "Cargo.lock" }}
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
version: 2.1
|
|
||||||
marine:
|
|
||||||
jobs:
|
|
||||||
- sqlite_connector_rust_tests
|
|
3
.github/actionlint.yaml
vendored
Normal file
3
.github/actionlint.yaml
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
self-hosted-runner:
|
||||||
|
labels:
|
||||||
|
- builder
|
14
.github/download_marine.sh
vendored
14
.github/download_marine.sh
vendored
@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -o pipefail -o errexit -o nounset
|
|
||||||
set -x
|
|
||||||
|
|
||||||
MARINE_RELEASE="https://api.github.com/repos/fluencelabs/marine/releases/latest"
|
|
||||||
OUT_DIR=/usr/local/bin
|
|
||||||
|
|
||||||
# get metadata about release
|
|
||||||
curl -s -H "Accept: application/vnd.github.v3+json" $MARINE_RELEASE |
|
|
||||||
# extract url and name for asset with name "marine"
|
|
||||||
# also append $OUT_DIR to each name so file is saved to $OUT_DIR
|
|
||||||
jq -r ".assets | .[] | select(.name == \"marine\") | \"\(.browser_download_url) $OUT_DIR/\(.name)\"" |
|
|
||||||
# download assets
|
|
||||||
xargs -n2 bash -c 'curl -L $0 -o $1 && chmod +x $1'
|
|
9
.github/release-please/config.json
vendored
Normal file
9
.github/release-please/config.json
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"bootstrap-sha": "69e3f8f7a472f688d560b34d6e7670b2c28aeae8",
|
||||||
|
"release-type": "rust",
|
||||||
|
"bump-minor-pre-major": true,
|
||||||
|
"bump-patch-for-minor-pre-major": true,
|
||||||
|
"packages": {
|
||||||
|
".": {}
|
||||||
|
}
|
||||||
|
}
|
3
.github/release-please/manifest.json
vendored
Normal file
3
.github/release-please/manifest.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
".": "0.8.0"
|
||||||
|
}
|
43
.github/workflows/ci.yml
vendored
Normal file
43
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "master"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
name: "cargo test"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Rust toolchain
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
|
||||||
|
- name: Install marine
|
||||||
|
uses: baptiste0928/cargo-install@v1.3.0
|
||||||
|
with:
|
||||||
|
crate: marine
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: ./build.sh
|
||||||
|
|
||||||
|
- name: Run cargo test
|
||||||
|
run: cargo test --release --all-features
|
||||||
|
|
||||||
|
- name: Run cargo fmt
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
# - name: Run cargo clippy
|
||||||
|
# run: cargo clippy --all --all-features
|
35
.github/workflows/lint.yml
vendored
Normal file
35
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
name: lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- synchronize
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pr:
|
||||||
|
name: Validate PR title
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: amannn/action-semantic-pull-request@v5
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
reviewdog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Lint actions
|
||||||
|
uses: reviewdog/action-actionlint@v1
|
||||||
|
env:
|
||||||
|
SHELLCHECK_OPTS: "-e SC2086 -e SC2207 -e SC2128"
|
||||||
|
with:
|
||||||
|
reporter: github-pr-check
|
||||||
|
fail_on_error: true
|
124
.github/workflows/release.yml
vendored
Normal file
124
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
name: "release"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "master"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-please:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
release-created: ${{ steps.release.outputs['release_created'] }}
|
||||||
|
tag-name: ${{ steps.release.outputs['tag_name'] }}
|
||||||
|
version: ${{ steps.release.outputs['version'] }}
|
||||||
|
pr: ${{ steps.release.outputs['pr'] }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Run release-please
|
||||||
|
id: release
|
||||||
|
uses: google-github-actions/release-please-action@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
|
||||||
|
command: manifest
|
||||||
|
config-file: .github/release-please/config.json
|
||||||
|
manifest-file: .github/release-please/manifest.json
|
||||||
|
|
||||||
|
- name: Show output from release-please
|
||||||
|
if: steps.release.outputs.releases_created
|
||||||
|
env:
|
||||||
|
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
|
||||||
|
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq
|
||||||
|
|
||||||
|
publish:
|
||||||
|
if: needs.release-please.outputs.release-created
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: release-please
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
|
||||||
|
|
||||||
|
- name: Import secrets
|
||||||
|
uses: hashicorp/vault-action@v2.4.3
|
||||||
|
with:
|
||||||
|
url: https://vault.fluence.dev
|
||||||
|
path: jwt/github
|
||||||
|
role: ci
|
||||||
|
method: jwt
|
||||||
|
jwtGithubAudience: "https://github.com/fluencelabs"
|
||||||
|
jwtTtl: 300
|
||||||
|
exportToken: false
|
||||||
|
secrets: |
|
||||||
|
kv/crates.io/fluencebot token | CARGO_REGISTRY_TOKEN ;
|
||||||
|
|
||||||
|
- name: Setup Rust toolchain
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
|
||||||
|
- name: Install Marine
|
||||||
|
uses: baptiste0928/cargo-install@v1.3.0
|
||||||
|
with:
|
||||||
|
crate: marine
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: ./build.sh
|
||||||
|
|
||||||
|
- name: Publish to crates.io
|
||||||
|
run: cargo publish
|
||||||
|
|
||||||
|
slack:
|
||||||
|
if: always()
|
||||||
|
name: "Notify"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- release-please
|
||||||
|
- publish
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: lwhiteley/dependent-jobs-result-check@v1
|
||||||
|
id: status
|
||||||
|
with:
|
||||||
|
statuses: failure
|
||||||
|
dependencies: ${{ toJSON(needs) }}
|
||||||
|
|
||||||
|
- name: Log output
|
||||||
|
run: |
|
||||||
|
echo "statuses:" "${{ steps.status.outputs.statuses }}"
|
||||||
|
echo "jobs:" "${{ steps.status.outputs.jobs }}"
|
||||||
|
echo "found any?:" "${{ steps.status.outputs.found }}"
|
||||||
|
|
||||||
|
- name: Import secrets
|
||||||
|
uses: hashicorp/vault-action@v2.4.3
|
||||||
|
with:
|
||||||
|
url: https://vault.fluence.dev
|
||||||
|
path: jwt/github
|
||||||
|
role: ci
|
||||||
|
method: jwt
|
||||||
|
jwtGithubAudience: "https://github.com/fluencelabs"
|
||||||
|
jwtTtl: 300
|
||||||
|
exportToken: false
|
||||||
|
secrets: |
|
||||||
|
kv/slack/release-please webhook | SLACK_WEBHOOK_URL
|
||||||
|
|
||||||
|
- uses: ravsamhq/notify-slack-action@v2
|
||||||
|
if: steps.status.outputs.found == 'true'
|
||||||
|
with:
|
||||||
|
status: "failure"
|
||||||
|
notification_title: "*{workflow}* has {status_message}"
|
||||||
|
message_format: "${{ steps.status.outputs.jobs }} {status_message} in <{repo_url}|{repo}>"
|
||||||
|
footer: "<{run_url}>"
|
4
rust-toolchain.toml
Normal file
4
rust-toolchain.toml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "nightly-2022-12-06"
|
||||||
|
targets = ["x86_64-unknown-linux-gnu", "wasm32-wasi", "wasm32-unknown-unknown"]
|
||||||
|
components = ["rustfmt", "clippy"]
|
Loading…
x
Reference in New Issue
Block a user