Skip to content

Commit

Permalink
Merge pull request #2942 from mitch1024/master
Browse files Browse the repository at this point in the history
Refactor CICDs
  • Loading branch information
mitch1024 authored Jun 6, 2024
2 parents b7c09e2 + e054531 commit 8467326
Show file tree
Hide file tree
Showing 15 changed files with 1,959 additions and 5,935 deletions.
60 changes: 0 additions & 60 deletions .github/workflows/BuildAndPublish.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name: "CodeQL"

on:
push:
branches: [ master, develop, documents, hotfix/*, release* ]
branches: [ master, develop, hotfix/*, release/* ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
Expand All @@ -39,11 +39,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
73 changes: 73 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build and Deploy Docs

on:
push:
branches: [ "master" ]
paths: [ "docs/**" ]

jobs:
setup-build-publish:
name: Setup, Build and Publish
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: 'docs/'
sparse-checkout-cone-mode: false

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
file: ./docs/Dockerfile
push: true
tags: irisnet/docs:${{ github.sha }}

deploy:
name: Deploy
runs-on: arc-runner-set
environment: production

permissions:
contents: 'read'
id-token: 'write'

steps:
- name: 'Set up Google Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
install_components: "gke-gcloud-auth-plugin"

- name: Set up Kubectl
uses: azure/setup-kubectl@v3
with:
version: 'v1.21.0'

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.GKE_PROJECT }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENDITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
token_format: 'access_token'

- name: Set up GKE credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ secrets.GKE_CLUSTER }}
location: ${{ secrets.GKE_REGION }}

- name: Deploy to GKE
run: |
gcloud container clusters get-credentials app --region ${{ secrets.GKE_REGION }} --project ${{ secrets.GKE_PROJECT }}
kubectl set image -n irisnet deployment/irisnet-docs frontend=irisnet/docs:${{ github.sha }}
kubectl rollout status -n irisnet deployment/irisnet-docs
30 changes: 30 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and Publish Docker Image
on:
push:
branches:
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5

jobs:
setup-build-publish:
name: Setup, Build and Publish
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
push: true
tags: irisnet/irishub:${{ github.ref == 'refs/tags/*' && github.ref || github.sha }}
62 changes: 0 additions & 62 deletions .github/workflows/release-binary.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
setup-build-publish:
name: Setup, Build and Publish
runs-on: ubuntu-latest
steps:
- name: Checkout Codes
uses: actions/checkout@v4

- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: '^1.21.0' # The Go version to download (if necessary) and use.

- name: Build Binaries
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu
make build-all-binaries
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE.md
files: |
build/iris-linux-amd64
build/iris-linux-arm64
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: TestUnit
name: Run Unit Tests
on: [pull_request]

jobs:
test-unit:
name: Test Units
# runs-on: self-hosted
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v1
- name: Setup go
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '^1.21' # The Go version to download (if necessary) and use.
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ build/
.out
docs/.vuepress/dist/
node_modules/
package.json
yarn.lock
dependency-graph.png
mytestnet
buf-stamp
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,9 @@ endif
build-linux: check-evm-chain-id go.sum
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build

build-all-binary: check-evm-chain-id go.sum
build-all-binaries: check-evm-chain-id go.sum
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build $(BUILD_FLAGS) -o build/iris-linux-amd64 ./cmd/iris
LEDGER_ENABLED=false GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc go build $(BUILD_FLAGS) -o build/iris-linux-arm64 ./cmd/iris
LEDGER_ENABLED=false GOOS=windows GOARCH=amd64 CGO_ENABLED=1 go build $(BUILD_FLAGS) -o build/iris-windows-amd64.exe ./cmd/iris

build-contract-tests-hooks:
ifeq ($(OS),Windows_NT)
Expand Down Expand Up @@ -251,4 +250,4 @@ start-rly:
kill-dev:
@echo "Killing nftd and removing previous data"
-@rm -rf ./data
-@killall nftd 2>/dev/null
-@killall nftd 2>/dev/null
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO
6 changes: 3 additions & 3 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:alpine AS builder
WORKDIR /app
COPY package.json yarn.lock ./
COPY docs/package.json docs/yarn.lock ./
RUN yarn install
COPY . .
COPY docs/ .
RUN yarn run build

FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /app/.vuepress/dist /usr/share/nginx/html/docs
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
## About IRISnet

IRISnet (a.k.a IRIS Hub) is designed to be the foundation for the next generation distributed applications. Built with Cosmos-SDK, IRIS Hub enables cross-chain interoperability through a unified service model, while providing a variety of modules to support distributed business applications.

Loading

0 comments on commit 8467326

Please sign in to comment.