-
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
1 changed file
with
74 additions
and
0 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,74 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# 1. Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# 2. Set up Rust toolchain | ||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
override: true | ||
|
||
# 3. Install necessary system dependencies | ||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y pkg-config libssl-dev build-essential curl tar | ||
# 4. Install Binaryen | ||
- name: Install Binaryen | ||
env: | ||
BINARYEN_VERSION: 120_b | ||
run: | | ||
curl -L -o binaryen.tar.gz https://github.com/WebAssembly/binaryen/releases/download/version_${{ env.BINARYEN_VERSION }}/binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz | ||
tar -xzf binaryen.tar.gz | ||
sudo mv binaryen-version_${BINARYEN_VERSION} /opt/binaryen | ||
sudo ln -s /opt/binaryen/bin/wasm-opt /usr/local/bin/wasm-opt | ||
rm binaryen.tar.gz | ||
# 5. Install trunk | ||
- name: Install trunk | ||
run: cargo install --locked trunk | ||
|
||
# 6. Build the project | ||
- name: Build project | ||
run: trunk build --release --dist=dist | ||
|
||
# 7. Run tests (if any) | ||
- name: Run Tests | ||
run: cargo test --release | ||
|
||
# 8. Set up Docker Buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# 9. Log in to Docker Hub | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
# 10. Build and push the Docker image | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: thadah/v_vmifier:latest |