-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: vados <[email protected]>
- Loading branch information
Showing
6 changed files
with
187 additions
and
178 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,120 @@ | ||
name: build-and-test | ||
description: Build and test pg_idkit (meant to run inside pg_idkit/builder container) | ||
inputs: | ||
artifact-name: | ||
type: string | ||
description: | | ||
Desired artifact name (will replace the natural name) | ||
rust-container-version: | ||
type: string | ||
default: 1.73 | ||
description: | | ||
Version of rust to use in the container | ||
apt-cache-dir: | ||
type: string | ||
default: /var/cache/apt | ||
cargo-home-dir: | ||
type: string | ||
default: /usr/local/cargo | ||
cargo-target-dir: | ||
type: string | ||
default: /usr/local/build/target | ||
sccache-dir: | ||
type: string | ||
default: /usr/local/sccache | ||
cargo-build-rustc-wrapper: | ||
type: string | ||
default: /usr/local/cargo/bin/sccache | ||
cargo-env-incremental: | ||
type: string | ||
default: "0" | ||
cargo-env-profile: | ||
type: string | ||
default: ci | ||
outputs: {} | ||
runs: | ||
using: "composite" | ||
env: | ||
CARGO_HOME: ${{ inputs.cargo-home-dir }} | ||
CARGO_TARGET_DIR: ${{ inputs.cargo-target-dir }} | ||
SCCACHE_DIR: ${{ inputs.sccache-dir }} | ||
CARGO_BUILD_RUSTC_WRAPPER: ${{ inputs.cargo-build-rustc-wrapper }} | ||
CARGO_INCREMENTAL: ${{ inputs.cargo-env-incrmental }} | ||
CARGO_PROFILE: ${{ inputs.cargo-profile }} | ||
steps: | ||
# Checkout the repo | ||
- uses: actions/checkout@v3 | ||
|
||
######### | ||
# Cache # | ||
######### | ||
|
||
- name: Cache CARGO_HOME | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
${{ inputs.cargo-home-dir }} | ||
key: pg_idkit-tests-rust-${{ inputs.rust-container-version }}-cargo-${{ runner.os }} | ||
|
||
- name: Cache apt install | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
${{ inputs.apt-cache-dir }} | ||
key: pg_idkit-tests-apt-cache-${{ inputs.rust-container-version }}-cargo-${{ runner.os }} | ||
|
||
- name: Cache sccache | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
${{ inputs.sccache-dir }} | ||
key: pg_idkit-tests-sccache-${{ inputs.rust-container-version }}-cargo-${{ runner.os }} | ||
|
||
############### | ||
# Build/Tests # | ||
############### | ||
|
||
- name: Add idkit to group | ||
run: | | ||
chgrp -R idkit $HOME && | ||
chgrp -R idkit /__w/pg_idkit && | ||
chmod g+w -R /__w/pg_idkit | ||
# Run cargo build | ||
- name: Run cargo test | ||
run: | | ||
su idkit -c "cargo build" | ||
# Run cargo check | ||
- name: Run cargo check | ||
run: | | ||
su idkit -c "cargo check" | ||
# Run cargo test | ||
- name: Run cargo test | ||
run: | | ||
su idkit -c "cargo test" | ||
############# | ||
# Artifacts # | ||
############# | ||
|
||
# Run cargo test | ||
- name: Build a package | ||
id: package | ||
if: ${{ github.event_name == 'workflow_call' }} | ||
run: | | ||
su idkit -c "just package" | ||
tar -cvf pg_idkit-$(just print-version).zip $(just print-pkg-output-dir) | ||
echo filename=pg_idkit-$(just print-version).zip >> $GITHUB_OUTPUT | ||
# Upload artifact | ||
- name: Upload artifact | ||
if: ${{ github.event_name == 'workflow_call' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact-name || steps.package.outputs.filename }} | ||
path: ${{ steps.package.outputs.filename }} |
This file was deleted.
Oops, something went wrong.
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,64 @@ | ||
name: build-rpm | ||
description: Build an RPM for pg_idkit | ||
inputs: | ||
artifact-name: | ||
type: string | ||
description: | | ||
Desired artifact name (will replace the natural name) | ||
gh-runner: | ||
type: string | ||
default: ubuntu-latest | ||
decription: | | ||
GitHub runner to use | ||
rpm-arch: | ||
type: string | ||
default: x86_64 | ||
decription: | | ||
Architecture to use while building the RPM | ||
pgrx-version: | ||
type: string | ||
default: pg15 | ||
decription: | | ||
PGRX version (ex. 'pg15', 'pg16') | ||
outputs: | ||
random-number: | ||
description: "Random number" | ||
value: ${{ steps.random-number-generator.outputs.random-number }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Cache default PGRX_HOME | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
/home/runner/.pgrx | ||
key: pg_idkit-pkg-rpm-pgrx-${{ inputs.rpm-arch }}-${{ inputs.gh-runner }} | ||
|
||
- name: Install Rust deps | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-binstall,cargo-get,just,cargo-generate-rpm,[email protected] | ||
|
||
- name: Initialize cargo-pgrx | ||
run: | | ||
[[ -d /home/runner/.pgrx ]] || cargo pgrx init | ||
- name: Build RPM | ||
run: just package build-rpm | ||
|
||
- name: Get RPM output path | ||
id: rpm-output | ||
run: | | ||
echo path=$(just print-rpm-output-path) >> $GITHUB_OUTPUT | ||
echo filename=$(just print-rpm-output-file-name) >> $GITHUB_OUTPUT | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.rpm-output.outputs.filename }} | ||
path: ${{ steps.rpm-output.outputs.path }} |
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