Skip to content

Commit

Permalink
Merge pull request #13 from adnanjpg/gh-actions
Browse files Browse the repository at this point in the history
test: add a ci action
  • Loading branch information
adnanjpg authored Jan 1, 2024
2 parents 8c0b4a4 + bbabd54 commit 1629b07
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/build-and-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# a composite action, as described here:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
name: "Build and test app"
description: "Build and test app on different platforms"
runs:
using: "composite"
steps:
- uses: actions/checkout@v2
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: 🔨 Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features

- name: 🔎 Test
uses: actions-rs/cargo@v1
with:
command: test
args: --release

# https://stackoverflow.com/a/64702025/12555423
# these will be used once we add integration tests
# - name: ⚙ Integration test
# uses: actions-rs/cargo@v1
# with:
# command: test
# args: --release --features "integration_tests"
31 changes: 31 additions & 0 deletions .github/workflows/build-and-test-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on: [pull_request]

name: CI for pull requests

jobs:
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
build_and_test_ubuntu:
name: Build and test on Ubuntu
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- id: build_and_test
uses: ./.github/build-and-test

# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
build_and_test_windows:
name: Build and test on Windows
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- id: build_and_test
uses: ./.github/build-and-test

# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
build_and_test_macos:
name: Build and test on macOS
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- id: build_and_test
uses: ./.github/build-and-test
12 changes: 12 additions & 0 deletions .github/workflows/build-and-test-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on: [push]

name: CI for push

jobs:
build_and_test_ubuntu:
name: Build and test on Ubuntu
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Build and test on ubuntu
uses: ./.github/build-and-test

0 comments on commit 1629b07

Please sign in to comment.