diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..6efc4ab --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,63 @@ +name: Run tests + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + # Check out code + - name: Checkout + uses: actions/checkout@v2 + # This is the a separate action that sets up buildx runner + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + # So now you can use Actions' own caching! + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - run: cp .env.example .env + - uses: actions/setup-node@v2 + with: + node-version: '14' + - run: npm install + - run: npm run build + # And make it available for the builds + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: false + tags: user/app:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + # This ugly bit is necessary if you don't want your cache to grow forever + # till it hits GitHub's limit of 5GB. + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - run: npm install + - run: npm test + deploy: + runs-on: ubuntu-latest + environment: + name: production + url: https://github.com + steps: + - name: deploy + run: echo Test \ No newline at end of file diff --git a/package.json b/package.json index c017d19..df8b0e5 100755 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "start": "babel-node ./bin/www.js", "start:dev": "DEBUG=maxfacts node-dev ./bin/www.js", + "build": "gulp clean && gulp", "backup": "rm -rf data/dump/* && mongodump -d maxfacts -o data/dump && mv data/dump/maxfacts/* data/dump && rm -r data/dump/maxfacts", "backup:copy": "npm run backup && copy; cp -R data/dump /shared/storage/cs/staffstore/lt696/maxfacts-backups/$(date \"+%Y-%m-%d-%Hh-%Mm\")", "restore": "mongo maxfacts --eval \"db.dropDatabase();\"; cd data/dump; mongorestore -d maxfacts maxfacts",