-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
302 additions
and
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
test: | ||
name: Test on ${{ matrix.config.os }} ${{ matrix.config.arch }} | ||
runs-on: ${{ matrix.config.platform }} | ||
strategy: | ||
matrix: | ||
config: | ||
- {platform: windows-latest, os: windows, arch: amd64, path: windows-x86_64} | ||
- {platform: macos-13, os: darwin, arch: amd64, path: darwin-x86_64} | ||
- {platform: macos-latest, os: darwin, arch: arm64, path: darwin-arm64} | ||
- {platform: ubuntu-latest, os: linux, arch: amd64, path: linux-x86_64} | ||
- {platform: raspbian-private, os: linux, arch: arm64, path: linux-arm64} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
|
||
- name: Install OpenSSL and pkg-config (Linux ARM64 only) | ||
if: matrix.config.path == 'linux-arm64' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libssl-dev pkg-config | ||
- name: Set PKG_CONFIG_PATH (Linux ARM64 only) | ||
if: matrix.config.path == 'linux-arm64' | ||
run: echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV | ||
|
||
- name: Install clippy | ||
run: rustup component add clippy --toolchain stable | ||
|
||
- name: Run clippy | ||
run: make clippy | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
- name: Build release artifact | ||
if: github.ref == 'refs/heads/master' | ||
run: make build | ||
|
||
- name: Upload artifacts | ||
if: github.ref == 'refs/heads/master' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: core-etl-${{ matrix.config.path }} | ||
path: ./target/release/core-etl${{ matrix.config.os == 'windows' && '.exe' || '' }} | ||
|
||
release: | ||
if: github.ref == 'refs/heads/master' | ||
needs: test | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
|
||
- name: Get version from Cargo.toml | ||
id: cargo-version | ||
run: echo "::set-output name=VERSION::$(grep '^version =' Cargo.toml | sed -E 's/version = \"(.*)\"/\1/')" | ||
|
||
- name: Create new tag | ||
id: tag | ||
run: | | ||
git fetch --tags | ||
TAG_EXISTS=$(git tag -l "v${{ steps.cargo-version.outputs.VERSION }}") | ||
if [ -n "$TAG_EXISTS" ]; then | ||
echo "Tag v${{ steps.cargo-version.outputs.VERSION }} already exists" | ||
exit 1 | ||
fi | ||
git tag v${{ steps.cargo-version.outputs.VERSION }} | ||
git push origin v${{ steps.cargo-version.outputs.VERSION }} | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: v${{ steps.cargo-version.outputs.VERSION }} | ||
release_name: Release v${{ steps.cargo-version.outputs.VERSION }} | ||
draft: false | ||
prerelease: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
artifacts: | ||
needs: release | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
platform: [ | ||
{path: linux-x86_64, file_ext: ""}, | ||
{path: windows-x86_64, file_ext: ".exe"}, | ||
{path: linux-arm64, file_ext: ""}, | ||
{path: darwin-x86_64, file_ext: ""}, | ||
{path: darwin-arm64, file_ext: ""}, | ||
] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: core-etl-${{ matrix.platform.path }} | ||
path: ./core-etl-${{ matrix.platform.path }} | ||
|
||
- name: Upload release assets | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.release.outputs.upload_url }} | ||
asset_path: ./core-etl-${{ matrix.platform.path }}/core-etl${{ matrix.platform.file_ext }} | ||
asset_name: core-etl-${{ matrix.platform.path }}${{ matrix.platform.file_ext }} | ||
asset_content_type: application/octet-stream |
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,41 @@ | ||
D | ||
on: | ||
workflow_run: | ||
workflows: ["ci.yml"] | ||
types: | ||
- completed | ||
with: | ||
ref: main | ||
status: success | ||
conclusion: success | ||
steps: | ||
- name: artifacts | ||
jobs: | ||
docker: | ||
name: docker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Get version from Cargo.toml | ||
id: cargo-version | ||
run: echo "::set-output name=VERSION::$(grep '^version =' Cargo.toml | sed -E 's/version = \"(.*)\"/\1/')" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver-opts: network=host | ||
- name: Install QEMU for Multi-Platform Builds | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Log in to GitHub Container Registry | ||
run: | | ||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
- name: Build and Push Docker Image for Multiple Architectures | ||
run: | | ||
docker buildx create --use | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64 \ | ||
--tag ghcr.io/core-coin/core-etl:v${{ steps.cargo-version.outputs.VERSION }} \ | ||
--tag ghcr.io/core-coin/core-etl:latest \ | ||
--push . | ||
- name: Verify Image Digest (Optional) | ||
run: docker buildx imagetools inspect ghcr.io/core-coin/core-etl:latest |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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.