Run CI tests for every push to master (#123)

* workflows: Separate release workflow from main.
This commit is contained in:
Giacomo Leidi 2022-01-05 23:52:25 +01:00 committed by GitHub
parent 5bce70b4a1
commit 8569a903f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 37 deletions

View File

@ -6,8 +6,7 @@ name: CI
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- v*
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
@ -16,7 +15,7 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
run-tests-dev:
# The type of runner that the job will run on
runs-on: ubuntu-latest
@ -25,43 +24,29 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies
run: scripts/install_github_actions_dev_dependencies.sh
- name: Run tests in dev env
run: poetry run pytest
run-tests-preprod:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Install GNU Guix
uses: PromyLOPh/guix-install-action@v1
# Runs a set of commands using the runners shell
- name: Build image
run: scripts/build_docker_image.sh
- name: Upload pack (Docker)
uses: actions/upload-artifact@v2
with:
name: mobilizon-reshare-docker
path: docker-image.tar.gz
publish:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: build
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Get release tag
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Download image
uses: actions/download-artifact@v2
with:
name: mobilizon-reshare-docker
- name: Publish to Docker Hub
uses: fishinthecalculator/publish-docker-image-action@v0.1.3
env:
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
with:
name: fishinthecalculator/mobilizon-reshare
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
image: docker-image.tar.gz
- name: Run tests in preprod env
run: guix time-machine -C channels-lock.scm -- build -L . mobilizon-reshare.git

67
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,67 @@
# This is a basic workflow to help you get started with Actions
name: Publish release to Docker Hub
# Controls when the workflow will run
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- v*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Install GNU Guix
uses: PromyLOPh/guix-install-action@v1
# Runs a set of commands using the runners shell
- name: Build image
run: scripts/build_docker_image.sh
- name: Upload pack (Docker)
uses: actions/upload-artifact@v2
with:
name: mobilizon-reshare-docker
path: docker-image.tar.gz
publish:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: build
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Get release tag
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Download image
uses: actions/download-artifact@v2
with:
name: mobilizon-reshare-docker
- name: Publish to Docker Hub
uses: fishinthecalculator/publish-docker-image-action@v0.1.3
env:
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
with:
name: fishinthecalculator/mobilizon-reshare
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
image: docker-image.tar.gz

View File

@ -0,0 +1,7 @@
#!/bin/sh
set -eux
python -m pip install --upgrade pip
pip install poetry
poetry install