diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..0cf95c5 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,89 @@ +name: ๐Ÿš€ + +on: + pull_request: { } + push: { branches: [ main ] } + +env: + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + +jobs: + test: + name: ๐Ÿงช Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2-beta + with: + node-version: '10' + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v2 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: install dependencies + run: npm install && npm install --prefix functions + - name: run linter + run: npm run lint + - name: run tests + run: npm run test && npm run test --prefix functions +# - name: Upload test results +# uses: actions/upload-artifact@v1 +# with: +# name: Test results +# path: "**/artifacs" + + build: + name: ๐Ÿ›  Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2-beta + with: + node-version: '10' + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v2 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: install dependencies + run: npm install && npm install --prefix functions + - name: build + run: npm run build --prefix functions + + deploy: + name: โœจ Deploy + needs: [ test, build ] + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2-beta + with: + node-version: '10' + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v2 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: install dependencies + run: npm install && npm install --prefix functions + - name: Deploy to Firebase + uses: w9jds/firebase-action@v1.1.0 + with: + args: deploy diff --git a/functions/package.json b/functions/package.json index 304e5e2..c4c1ae4 100644 --- a/functions/package.json +++ b/functions/package.json @@ -7,7 +7,8 @@ "shell": "npm run build && firebase functions:shell", "start": "npm run shell", "deploy": "firebase deploy --only functions", - "logs": "firebase functions:log" + "logs": "firebase functions:log", + "test": "echo \"No tests yet, feel free to add\" && exit 0" }, "engines": { "node": "10" diff --git a/package.json b/package.json index 4039377..b5fa8a5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Stateful backend to keep track of unity versions and docker build queues", "main": "src/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "lint": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\" \"functions/src/**/*.{js,jsx,ts,tsx}\"", + "test": "echo \"No tests yet, feel free to add\" && exit 0" }, "repository": { "type": "git", diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..61e8e22 --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +// Optionally generate public folder from here