-
Notifications
You must be signed in to change notification settings - Fork 19
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 #1125 from oasisprotocol/matevz/feature/code-snippets
examples: Migrate code snippets from .md files to separate sources
- Loading branch information
Showing
22 changed files
with
868 additions
and
616 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
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,119 @@ | ||
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge. | ||
name: ci-examples | ||
|
||
# Trigger the workflow when: | ||
on: | ||
# A push occurs to one of the matched branches. | ||
push: | ||
branches: | ||
- main | ||
- stable/* | ||
# Or when a pull request event occurs for a pull request against one of the | ||
# matched branches. | ||
pull_request: | ||
branches: | ||
- main | ||
- stable/* | ||
|
||
# Cancel in-progress jobs on same branch. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint-test-runtime-sdk: | ||
name: lint-test-runtime-sdk | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
example: [runtime-sdk/minimal-runtime] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
components: rustfmt, clippy | ||
|
||
# Generate Cargo.lock needed for linting. | ||
- name: Generate Cargo.lock | ||
working-directory: examples/${{ matrix.example }} | ||
run: cargo generate-lockfile | ||
|
||
- name: Lint ${{ matrix.example }} | ||
uses: ./.github/actions/lint-rust | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
manifest_path: examples/${{ matrix.example }}/Cargo.toml | ||
|
||
- name: Build and test ${{ matrix.example }} | ||
working-directory: examples/${{ matrix.example }} | ||
run: cargo test | ||
|
||
lint-test-contract-sdk: | ||
name: lint-test-contract-sdk | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
example: [contract-sdk/hello-world, contract-sdk/c10l-hello-world] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
target: wasm32-unknown-unknown | ||
components: rustfmt, clippy | ||
|
||
# Generate Cargo.lock needed for linting. | ||
- name: Generate Cargo.lock | ||
working-directory: examples/${{ matrix.example }} | ||
run: cargo generate-lockfile | ||
|
||
- name: Lint ${{ matrix.example }} | ||
uses: ./.github/actions/lint-rust | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
manifest_path: examples/${{ matrix.example }}/Cargo.toml | ||
|
||
- name: Build ${{ matrix.example }} for wasm32 | ||
working-directory: examples/${{ matrix.example }} | ||
run: cargo build --target wasm32-unknown-unknown --release | ||
|
||
- name: Test ${{ matrix.example }} | ||
working-directory: examples/${{ matrix.example }} | ||
run: cargo test | ||
|
||
lint-test-client-sdk-go: | ||
name: lint-test-client-sdk-go | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
example: [client-sdk/go/minimal-runtime-client] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.17.x' | ||
|
||
# Generate go.sum needed for linting. | ||
- name: Generate go.sum | ||
working-directory: examples/${{ matrix.example }} | ||
run: go get | ||
|
||
# NOTE: "file exists" tar errors can be safely ignored, because go is already installed. | ||
- name: Lint ${{ matrix.example }} | ||
uses: golangci/golangci-lint-action@v3.2.0 | ||
with: | ||
# NOTE: The version must be specified without the patch version. | ||
version: v1.40 | ||
working-directory: examples/${{ matrix.example }} | ||
|
||
- name: Build ${{ matrix.example }} | ||
working-directory: examples/${{ matrix.example }} | ||
run: go build |
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
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
Oops, something went wrong.