Skip to content

Commit

Permalink
Update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Arief Rahmansyah committed May 28, 2024
1 parent 90fb0e3 commit 46a1d5d
Showing 1 changed file with 34 additions and 48 deletions.
82 changes: 34 additions & 48 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
# Automatically run CI on Release and Pre-Release tags and main branch
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
- "v[0-9]+.[0-9]+.[0-9]+*"
branches:
- main
paths-ignore:
Expand All @@ -22,8 +22,8 @@ on:

env:
GO_VERSION: "1.20"
GO_LINT_VERSION: v1.51.2
NODE_VERSION: 16
GO_LINT_VERSION: v1.58.1
NODE_VERSION: 20
ARTIFACT_RETENTION_DAYS: 7
CONTAINER_REGISTRY: ghcr.io
LOCAL_REGISTRY: registry.localhost:5000
Expand All @@ -35,18 +35,12 @@ jobs:
build-ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: ui/node_modules
key: |
${{ runner.os }}-modules-${{ hashFiles('ui/yarn.lock') }}
restore-keys: ${{ runner.os }}-modules-
cache: yarn
cache-dependency-path: ui/yarn.lock

- name: Install
working-directory: ui
Expand All @@ -61,7 +55,7 @@ jobs:
run: make build-ui

- name: Publish Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: mlp-ui-dist
path: ui/build/
Expand All @@ -72,7 +66,7 @@ jobs:
outputs:
api-version: ${{ steps.build-image.outputs.api-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -90,7 +84,7 @@ jobs:
mlp-api:${{ steps.build-image.outputs.api-version }}
- name: Publish Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: mlp-api.${{ steps.build-image.outputs.api-version }}.tar
path: mlp-api.${{ steps.build-image.outputs.api-version }}.tar
Expand All @@ -101,25 +95,17 @@ jobs:
env:
GOPATH: ${{ github.workspace }}/.go
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Cache Dependencies
uses: actions/cache@v3
with:
path: .go/pkg/mod/
key: |
gomod-${{ hashFiles('go.mod') }}
restore-keys: gomod-
cache-dependency-path: api/go.sum

- name: Lint code
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.GO_LINT_VERSION }}
skip-go-installation: true
args: --timeout 3m --verbose api/...
working-directory: api

- name: Run Integration Test
run: make it-test-api
Expand All @@ -129,23 +115,23 @@ jobs:
flags: api-test
name: api-test
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: ./api
working-directory: api

e2e-test:
runs-on: ubuntu-latest
needs:
- build-api
- test-api
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: ${{ env.CARAML_CHARTS_REPOSITORY }}
ref: ${{ env.CARAML_CHARTS_REF }}
path: 'helm-charts'
path: "helm-charts"

- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

Expand All @@ -165,7 +151,7 @@ jobs:
--k3s-arg "--no-deploy=metrics-server@server:*"
- name: Download API image tar
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: mlp-api.${{ needs.build-api.outputs.api-version }}.tar

Expand Down Expand Up @@ -197,28 +183,28 @@ jobs:
echo "::group::describe deployment/mlp"
kubectl describe deployment/mlp
echo "::endgroup::"
echo "::group::configmap/mlp-config"
kubectl get cm/mlp-config -o jsonpath='{.data.mlp-config\.yaml}'
echo "::endgroup::"
echo "::group::logs deployment/mlp"
kubectl logs deployment/mlp
echo "::endgroup::"
echo "::group::kubernetes events"
kubectl get events
echo "::endgroup::"
echo "::group::kubernetes pod describe"
kubectl describe pod
echo "::endgroup::"
echo "::endgroup::"
- name: Setup MLP project
shell: bash
run: |
sleep 2
tee payload.json <<EOF
{
"name": "e2e-test",
Expand Down Expand Up @@ -273,7 +259,7 @@ jobs:
runs-on: ubuntu-latest
environment: ${{ needs.release-rules.outputs.release-type == 'dev' && 'manual' || '' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v2
Expand All @@ -283,12 +269,12 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Download API image tar
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: mlp-api.${{ needs.build-api.outputs.api-version }}.tar

- name: Download MLP UI Dist
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: mlp-ui-dist
path: ui/build
Expand All @@ -308,7 +294,7 @@ jobs:
changed: ${{ steps.changes.outputs.ui-lib }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: changes
with:
Expand Down Expand Up @@ -339,17 +325,17 @@ jobs:
runs-on: ubuntu-latest
environment: ${{ needs.release-rules.outputs.release-type == 'dev' && 'manual' || '' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org

- name: Cache Dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ui/node_modules
key: |
Expand All @@ -366,4 +352,4 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn set-version-from-git
yarn lib publish
yarn lib publish

0 comments on commit 46a1d5d

Please sign in to comment.