diff --git a/.dockerignore b/.dockerignore index fcbedbd..4ac4521 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,6 +2,7 @@ **/.dockerignore **/.env **/.git +**/.github **/.gitignore **/.project **/.settings diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..583decf --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/docker-image-dev.yml b/.github/workflows/docker-image-dev.yml new file mode 100644 index 0000000..ad405a4 --- /dev/null +++ b/.github/workflows/docker-image-dev.yml @@ -0,0 +1,51 @@ +name: Docker Dev Image CI + +on: + push: + branches: [ dev ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + # Checkout the Repo + - uses: actions/checkout@v2 + + # Install Node 16 + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 16 + + # Avoid running prepublish script + - run: npm set-script prepublish "" + + # Install dependencies + - run: npm install + + # Run tests + - run: npm test + + build: + needs: test + runs-on: ubuntu-latest + + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + push: true + tags: wolvan/poll.horse:dev diff --git a/.github/workflows/docker-image-master.yml b/.github/workflows/docker-image-master.yml new file mode 100644 index 0000000..8970496 --- /dev/null +++ b/.github/workflows/docker-image-master.yml @@ -0,0 +1,52 @@ +name: Docker Image CI + +on: + push: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + # Checkout the Repo + - uses: actions/checkout@v2 + + # Install Node 16 + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 16 + + # Avoid running prepublish script + - run: npm set-script prepublish "" + + # Install dependencies + - run: npm install + + # Run tests + - run: npm test + + build: + if: startsWith(github.event.ref, 'refs/tags') + needs: test + runs-on: ubuntu-latest + + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + push: true + tags: wolvan/poll.horse:latest diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..8eb5306 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,28 @@ +name: Run tests + +on: + push: + branches: [ dev, master ] + pull_request: + branches: [ dev ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x, 15.x, 16.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: npm set-script prepublish "" + - run: npm ci + - run: npm run build --if-present + - run: npm test \ No newline at end of file