From 7aa8217ee7809c25b703eec19cc21948214b0ccb Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> Date: Thu, 20 Jan 2022 19:31:16 -0800 Subject: [PATCH] Adding cache to test (#1426) Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- .github/workflows/permissions.yml | 18 +++++++++ portal-ui/tests/scripts/initialize-env.sh | 46 ++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/.github/workflows/permissions.yml b/.github/workflows/permissions.yml index 87137ef58..0fabf8ca0 100644 --- a/.github/workflows/permissions.yml +++ b/.github/workflows/permissions.yml @@ -27,7 +27,25 @@ jobs: node-version: '17' - name: Check out code into the Go module directory uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Make assets run: | make assets diff --git a/portal-ui/tests/scripts/initialize-env.sh b/portal-ui/tests/scripts/initialize-env.sh index 38a552156..d7081a942 100644 --- a/portal-ui/tests/scripts/initialize-env.sh +++ b/portal-ui/tests/scripts/initialize-env.sh @@ -67,7 +67,51 @@ __init__() { export GOPATH=/tmp/gopath export PATH=${PATH}:${GOPATH}/bin - go install github.com/minio/mc@latest + ARCH="`uname -m`" + case $ARCH in + 'i386') + ARCH='amd64' + alias ls='ls --color=auto' + ;; + 'x86_64') + ARCH='amd64' + alias ls='ls -G' + ;; + 'arm') + ARCH='arm64' + ;; + *) ;; + esac + + echo $ARCH + + + OS="`uname`" + case $OS in + 'Linux') + OS='linux' + alias ls='ls --color=auto' + ;; + 'FreeBSD') + OS='freebsd' + alias ls='ls -G' + ;; + 'WindowsNT') + OS='windows' + ;; + 'Darwin') + OS='darwin' + ;; + 'SunOS') + OS='solaris' + ;; + 'AIX') ;; + *) ;; + esac + + curl -sLO "https://dl.min.io/client/mc/release/$OS-$ARCH/mc" -o mc + chmod +x mc + mv mc /usr/local/bin add_alias }