mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
ci: docker: Combine test and build+publish workflows
This commit is contained in:
parent
a6fcc92d2a
commit
e80e1c0221
2 changed files with 27 additions and 28 deletions
29
.github/workflows/docker.yml
vendored
29
.github/workflows/docker.yml
vendored
|
@ -1,10 +1,13 @@
|
||||||
name: Docker
|
name: Docker
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'develop'
|
- 'develop'
|
||||||
tags:
|
tags:
|
||||||
- 'v?[0-9]+.[0-9]+.[0-9]+'
|
- 'v?[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
env:
|
||||||
|
TEST_TAG: etherpad/etherpad:test
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -15,8 +18,29 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Build and export to Docker
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
load: true
|
||||||
|
tags: ${{ env.TEST_TAG }}
|
||||||
|
-
|
||||||
|
name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
|
-
|
||||||
|
name: Test
|
||||||
|
run: |
|
||||||
|
docker run --rm -d -p 9001:9001 ${{ env.TEST_TAG }}
|
||||||
|
./src/bin/installDeps.sh
|
||||||
|
sleep 3
|
||||||
|
(cd src && npm run test-container)
|
||||||
|
git clean -dxf .
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
|
if: github.event_name == 'push'
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v3
|
uses: docker/metadata-action@v3
|
||||||
with:
|
with:
|
||||||
|
@ -28,16 +52,17 @@ jobs:
|
||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
-
|
-
|
||||||
name: Log in to Docker Hub
|
name: Log in to Docker Hub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name == 'push'
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
|
if: github.event_name == 'push'
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
26
.github/workflows/dockerfile.yml
vendored
26
.github/workflows/dockerfile.yml
vendored
|
@ -1,26 +0,0 @@
|
||||||
name: "Dockerfile"
|
|
||||||
|
|
||||||
# any branch is useful for testing before a PR is submitted
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
dockerfile:
|
|
||||||
# run on pushes to any branch
|
|
||||||
# run on PRs from external forks
|
|
||||||
if: |
|
|
||||||
(github.event_name != 'pull_request')
|
|
||||||
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
|
||||||
name: build image and run connectivity test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: docker build
|
|
||||||
run: |
|
|
||||||
docker build -t etherpad:test .
|
|
||||||
docker run -d -p 9001:9001 etherpad:test
|
|
||||||
./src/bin/installDeps.sh
|
|
||||||
sleep 3 # delay for startup?
|
|
||||||
cd src && npm run test-container
|
|
Loading…
Add table
Add a link
Reference in a new issue