From de58658eaebe417eb54466cc2c140e248cf817cf Mon Sep 17 00:00:00 2001 From: MickaelK Date: Fri, 10 Nov 2023 22:41:43 +1100 Subject: [PATCH] fix (CI): get rid of PAT in CI --- .github/workflows/ci.yml | 50 ++++++++++++++++------------------------ Makefile | 10 ++++++-- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 501d529b8..dd847dc5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - persist-credentials: false - uses: actions/setup-node@v3 with: node-version: 14.x @@ -38,6 +36,8 @@ jobs: go-version: 1.19 - name: Setup run: | + sudo apt install -y libraw-dev libjpeg-dev libpng-dev libheif-dev libwebp-dev libgif-dev + sudo apt install -y build-essential libstdc++6 libomp-dev mkdir -p ./dist/data/state/config cp config/config.json ./dist/data/state/config/ - name: Build @@ -51,31 +51,16 @@ jobs: - name: Verify run: timeout 5 ./dist/filestash || code=$?; if [[ $code -ne 124 ]]; then exit $code; fi - test_prepare: + test_frontend: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - persist-credentials: false - name: Clone test repo - env: - PAT: ${{ secrets.PAT }} - run: | - git clone --depth 1 https://mickael-kerjean:$PAT@github.com/mickael-kerjean/filestash-test test - chmod -R 777 ./test/ - - uses: actions/upload-artifact@master - with: - name: test - path: . - - test_frontend: - needs: test_prepare - runs-on: ubuntu-latest - steps: - - name: Restore - uses: actions/download-artifact@v3 + uses: actions/checkout@v3 with: - name: test + repository: mickael-kerjean/filestash-test + ssh-key: ${{ secrets.DEPLOY_KEY_FILESTASH_TEST }} + path: test - uses: actions/setup-node@v3 with: node-version: 14.x @@ -90,13 +75,16 @@ jobs: npm test test_backend: - needs: [test_prepare, build_frontend, build_backend] + needs: [build_frontend, build_backend] runs-on: ubuntu-latest steps: - - name: Restore - uses: actions/download-artifact@v3 + - uses: actions/checkout@v3 + - name: Clone test repo + uses: actions/checkout@v3 with: - name: test + repository: mickael-kerjean/filestash-test + ssh-key: ${{ secrets.DEPLOY_KEY_FILESTASH_TEST }} + path: test - uses: actions/download-artifact@v3 with: name: build-frontend @@ -138,7 +126,7 @@ jobs: cat access.log | grep -vz "ERR" test_e2e: - needs: [test_smoke, test_prepare] + needs: [test_smoke] runs-on: ubuntu-latest container: image: machines/puppeteer @@ -152,10 +140,12 @@ jobs: uses: actions/download-artifact@v3 with: name: build - - name: Restore Project - uses: actions/download-artifact@v3 + - name: Clone test repo + uses: actions/checkout@v3 with: - name: test + repository: mickael-kerjean/filestash-test + ssh-key: ${{ secrets.DEPLOY_KEY_FILESTASH_TEST }} + path: test - name: Setup run: | cd ./test/e2e diff --git a/Makefile b/Makefile index 01c137d47..719faefa1 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: make build_init make build_frontend - GOARCH=amd64 GOOS=linux make build_backend + make build_backend build_init: go generate -x ./server/... @@ -10,7 +10,13 @@ build_frontend: NODE_ENV=production npm run build build_backend: - CGO_ENABLED=0 go build -ldflags="-extldflags=-static" -mod=vendor --tags "fts5" -o dist/filestash cmd/main.go + CGO_ENABLED=1 go build -mod=vendor --tags "fts5" -o dist/filestash cmd/main.go + +build_backend_arm64: + CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc go build -o dist/filestash cmd/main.go + +build_backend_amd64: + GOOS=linux CGO_ENABLED=1 GOARCH=amd64 CC=gcc go build -o dist/filestash cmd/main.go clean_frontend: rm -rf server/ctrl/static/www/