-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Use Github Actions to run integration tests and push Docker images
We're running against the usage limits in Gitlab CI (500), and Github Actions should have more (2000). So this patch replaces Gitlab CI with Github actions for running integration tests, and build and push Docker images (to Dockerhub and Gitlab registry). We'll see how the usage levels are in a few months.
- Loading branch information
Showing
5 changed files
with
121 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: "docker" | ||
|
||
on: | ||
push: | ||
branches: [ "master", "next" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master", "next" ] | ||
schedule: | ||
- cron: '29 21 * * 6' | ||
|
||
env: | ||
HAS_DOCKER: ${{ secrets.DOCKER_REGISTRY_USER != '' }} | ||
HAS_GITLAB: ${{ secrets.GITLAB_REGISTRY_USER != '' }} | ||
|
||
jobs: | ||
integration: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Docker info (for debugging) | ||
run: docker info | ||
- name: Build test image | ||
run: docker build -t chasquid-test -f test/Dockerfile . | ||
- name: Run tests | ||
run: docker run --name test1 chasquid-test make test | ||
|
||
public-image: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
needs: integration | ||
if: github.event_name == 'push' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: docker build -t chasquid -f docker/Dockerfile . | ||
|
||
# Push it to Dockerhub. | ||
- name: Dockerhub login | ||
if: env.HAS_DOCKER | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_REGISTRY_USER }} | ||
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | ||
- name: Dockerhub push | ||
if: env.HAS_DOCKER | ||
run: | | ||
docker tag chasquid index.docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/chasquid:$GITHUB_REF_NAME | ||
docker push index.docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/chasquid:$GITHUB_REF_NAME | ||
- name: Dockerhub tag latest | ||
if: env.HAS_DOCKER && env.GITHUB_REF_NAME == 'master' | ||
run: | | ||
docker tag chasquid index.docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/chasquid:latest | ||
docker push index.docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/chasquid:latest | ||
# Push it to Gitlab. | ||
- name: Gitlab login | ||
if: env.HAS_GITLAB | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: registry.gitlab.com | ||
username: ${{ secrets.GITLAB_REGISTRY_USER }} | ||
password: ${{ secrets.GITLAB_REGISTRY_TOKEN }} | ||
- name: Gitlab push | ||
if: env.HAS_GITLAB | ||
run: | | ||
docker tag chasquid registry.gitlab.com/albertito/chasquid:$GITHUB_REF_NAME | ||
docker push registry.gitlab.com/albertito/chasquid:$GITHUB_REF_NAME | ||
- name: Gitlab tag latest | ||
if: env.HAS_GITLAB && env.GITHUB_REF_NAME == 'master' | ||
run: | | ||
docker tag chasquid registry.gitlab.com/albertito/chasquid:latest | ||
docker push registry.gitlab.com/albertito/chasquid:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: "gotests" | ||
|
||
on: | ||
push: | ||
branches: [ "master", "next" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master", "next" ] | ||
schedule: | ||
- cron: '29 21 * * 6' | ||
|
||
jobs: | ||
oldest_supported: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: normal tests | ||
run: go test ./... | ||
- name: race tests | ||
run: go test -race ./... | ||
|
||
latest: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.x" | ||
check-latest: true | ||
- name: normal tests | ||
run: go test ./... | ||
- name: race tests | ||
run: go test -race ./... | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters