Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Smoke tests to CI and release flows #26

Merged
merged 5 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 67 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

jobs:
check:
name: Format, Clippy, Build
name: Format, Clippy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install dev tools
run: |
sudo apt update
Expand All @@ -37,21 +37,79 @@ jobs:
with:
command: clippy
args: -- -D warnings

build-linux:
name: Build Linux
runs-on: ubuntu-22.04
needs: [ check ]
steps:
- name: Install dev tools
run: |
sudo apt update
sudo apt -y install musl-tools libssl-dev
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
name: build --no-default-features
with:
command: build
args: --target x86_64-unknown-linux-musl --no-default-features
args: --release --target x86_64-unknown-linux-musl
- name: Smoke test
run: target/x86_64-unknown-linux-musl/release/pg_parcel --help


build-aarch64-apple-darwin:
name: Build macOS ARM
runs-on: macos-latest
needs: [ check ]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: aarch64-apple-darwin
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target aarch64-apple-darwin
# There's no ARM64 macos available in github actions.
# - name: Smoke test
# run: arch -arm64e target/aarch64-apple-darwin/release/pg_parcel --help

build-x86_64-apple-darwin:
name: Build macOS Intel
runs-on: macos-latest
needs: [ check ]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: x86_64-apple-darwin
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-apple-darwin
- name: Smoke test
run: target/x86_64-apple-darwin/release/pg_parcel --help

test:
name: Test
runs-on: ubuntu-22.04
needs: [ check ]
steps:
- name: Install dev tools
run: |
sudo apt update
sudo apt -y install musl-tools libssl-dev
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
30 changes: 18 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ on:
- "v*"

jobs:
aarch64-apple-darwin:
aarch64-apple-darwin-release:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed these jobs to avoid name conflicts with the jobs defined in build.yml.

name: Build macOS ARM
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: aarch64-apple-darwin
- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: build
Expand All @@ -28,32 +28,34 @@ jobs:
path: target/aarch64-apple-darwin/release/pg_parcel
if-no-files-found: error

x86_64-apple-darwin:
x86_64-apple-darwin-release:
name: Build macOS Intel
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: x86_64-apple-darwin
- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-apple-darwin
- name: Smoke test
run: target/x86_64-apple-darwin/release/pg_parcel --help
- uses: actions/upload-artifact@v2
with:
name: x86_64-apple-darwin
path: target/x86_64-apple-darwin/release/pg_parcel
if-no-files-found: error

macos-universal:
macos-universal-release:
name: Build macOS Universal
runs-on: macos-latest
needs: [aarch64-apple-darwin, x86_64-apple-darwin]
needs: [aarch64-apple-darwin-release, x86_64-apple-darwin-release]
steps:
- uses: actions/download-artifact@v2
with:
Expand All @@ -71,32 +73,36 @@ jobs:
-output pg_parcel-apple-darwin \
pg_parcel-x86_64-apple-darwin/pg_parcel \
pg_parcel-aarch64-apple-darwin/pg_parcel
- name: Smoke test
run: pg_parcel-apple-darwin --help
- uses: actions/upload-artifact@v2
with:
name: apple-darwin
path: pg_parcel-apple-darwin
if-no-files-found: error

build-linux:
build-linux-release:
name: Build Linux
runs-on: ubuntu-22.04
steps:
- name: Install dev tools
run: |
sudo apt update
sudo apt -y install musl-tools libssl-dev
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-unknown-linux-musl
- name: Smoke test
run: target/x86_64-unknown-linux-musl/release/pg_parcel --help
- uses: actions/upload-artifact@v2
with:
name: linux
Expand All @@ -105,7 +111,7 @@ jobs:

create-release:
name: Create release
needs: [macos-universal, build-linux]
needs: [macos-universal-release, build-linux-release]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v2
Expand Down