Skip to content

Commit

Permalink
fix (CI): get rid of PAT in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-kerjean committed Nov 10, 2023
1 parent 0ac2bde commit b8d1dfc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
51 changes: 21 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -51,31 +51,17 @@ jobs:
- name: Verify
run: timeout 5 ./dist/filestash || code=$?; if [[ $code -ne 124 ]]; then exit $code; fi

test_prepare:
test_frontend:
needs: [build_frontend, build_backend]
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
Expand All @@ -90,13 +76,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
Expand Down Expand Up @@ -138,7 +127,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
Expand All @@ -152,10 +141,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
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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/...
Expand All @@ -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/

0 comments on commit b8d1dfc

Please sign in to comment.