RandomSec/.github/workflows/snapshot_release.yml

214 lines
7.1 KiB
YAML
Raw Normal View History

name: Snapshot release
on:
push:
branches:
- master
jobs:
ui_tests:
runs-on: ubuntu-latest
strategy:
matrix:
browser: ['edge', 'chrome']
steps:
- uses: actions/checkout@v2.3.4
- name: Restore dependency cache
uses: actions/cache@v2.1.3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Install Edge
if: matrix.browser == 'edge'
run: |
sudo curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
sudo rm microsoft.gpg
sudo apt-get update
sudo apt-get install microsoft-edge-dev
- name: Build OpenRefine
run: ./refine build
- name: Restore Tests dependency cache
uses: actions/cache@v2.1.3
with:
path: |
~/cache
~/.cache
**/node_modules
!~/cache/exclude
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
- name: Install test dependencies
run: |
cd ./main/tests/cypress
npm i -g yarn
yarn install
- name: Test with Cypress on ${{ matrix.browser }}
run: |
echo REFINE_MIN_MEMORY=1400M >> ./refine.ini
echo REFINE_MEMORY=4096M >> ./refine.ini
./refine ui_test ${{ matrix.browser }} s5du3k "${{ secrets.CYPRESS_RECORD_KEY }}"
build:
services:
postgres:
image: postgres
ports:
- 5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 'postgres'
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8
ports:
- 3306
env:
MYSQL_ROOT_PASSWORD: root
options: >-
--health-cmd "mysqladmin ping"
--health-interval 5s
--health-timeout 2s
--health-retries 3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
2020-11-29 04:00:03 +01:00
with:
fetch-depth: 0 # This is wasteful, but needed for git describe
- name: Restore dependency cache
uses: actions/cache@v2.1.3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install genisoimage and jq
run: sudo apt-get install genisoimage jq
- name: Configure connections to databases
id: configure_db_connections
run: cat extensions/database/tests/conf/github_actions_tests.xml | sed -e "s/MYSQL_PORT/${{ job.services.mysql.ports[3306] }}/g" | sed -e "s/POSTGRES_PORT/${{ job.services.postgres.ports[5432] }}/g" > extensions/database/tests/conf/tests.xml
- name: Populate databases with test data
id: populate_databases_with_test_data
run: |
mysql -u root -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} -proot -e 'CREATE DATABASE test_db;'
mysql -u root -h 127.0.0.1 -P ${{ job.services.mysql.ports[3306] }} -proot < extensions/database/tests/conf/test-mysql.sql
psql -U postgres test_db -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} < extensions/database/tests/conf/test-pgsql.sql
env:
PGPASSWORD: postgres
- name: Build and test with Maven
run: mvn jacoco:prepare-agent test
- name: Submit test coverage to Coveralls
run: |
mvn prepare-package -DskipTests=true
mvn jacoco:report coveralls:report -DrepoToken=${{ secrets.COVERALLS_TOKEN }} -DpullRequest=${{ github.event.number }} -DserviceName="GitHub Actions" -DserviceBuildNumber=${{ env.GITHUB_RUN_ID }} -Dbranch=master
- name: Get the OpenRefine snapshot version
run: echo ::set-env name=OR_VERSION::$(cat ./main/webapp/WEB-INF/classes/git.properties | jq -r '.["git.commit.id.describe"]')
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Generate dist files
run: ./refine dist ${{ env.OR_VERSION }}
- name: Create Release
if: github.repository == 'OpenRefine/OpenRefine'
id: create_release
run: echo ::set-env name=API_RELEASE::$(./.github/workflows/release_manager.sh)
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
OR_VERSION: ${{ env.OR_VERSION }}
RELEASE_REPO_OWNER: OpenRefine
RELEASE_REPO_TOKEN: ${{ secrets.RELEASE_REPO_TOKEN }}
- name: Upload Release Asset Windows
id: upload-release-asset-win
if: github.repository == 'OpenRefine/OpenRefine'
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_REPO_TOKEN }}
with:
upload_url: ${{ env.API_RELEASE }}
asset_path: ./packaging/target/openrefine-win-${{ env.OR_VERSION }}.zip
asset_name: openrefine-win-${{ env.OR_VERSION }}.zip
asset_content_type: application/zip
- name: Upload Release Asset Linux
id: upload-release-asset-linux
if: github.repository == 'OpenRefine/OpenRefine'
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_REPO_TOKEN }}
with:
upload_url: ${{ env.API_RELEASE }}
asset_path: ./packaging/target/openrefine-linux-${{ env.OR_VERSION }}.tar.gz
asset_name: openrefine-linux-${{ env.OR_VERSION }}.tar.gz
asset_content_type: application/tar+gzip
- name: Upload Release Asset Mac
id: upload-release-asset-mac
if: github.repository == 'OpenRefine/OpenRefine'
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_REPO_TOKEN }}
with:
upload_url: ${{ env.API_RELEASE }}
asset_path: ./packaging/target/openrefine-mac-${{ env.OR_VERSION }}.dmg
asset_name: openrefine-mac-${{ env.OR_VERSION }}.dmg
asset_content_type: application/x-apple-diskimage
2020-06-16 23:26:41 +02:00
- name: Delete older releases
id: delete-older-releases
if: github.repository == 'OpenRefine/OpenRefine'
2020-06-16 23:26:41 +02:00
uses: dev-drprasad/delete-older-releases@v0.1.0
with:
repo: OpenRefine/OpenRefine-snapshot-releases
# Specifies number of latest releases (sorted by created_at) to keep. Pass 0 if you want to delete all releases
2020-06-16 23:26:41 +02:00
keep_latest: 10
# Specifies whether to delete tags associated to older releases or not.
# Older tags without any associated releases will not be deleted
delete_tags: true
2020-06-16 23:26:41 +02:00
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_REPO_TOKEN }}