piston/.github/workflows/package-pr.yaml

92 lines
2.5 KiB
YAML
Raw Normal View History

2021-02-28 03:58:02 +01:00
name: 'Package Pull Requests'
on:
2021-02-28 04:07:16 +01:00
pull_request:
2021-02-28 03:58:02 +01:00
types:
- opened
- edited
- reopened
- synchronize
paths:
- 'packages/**'
jobs:
2021-03-14 01:49:30 +01:00
build-pkg:
2021-02-28 07:30:35 +01:00
name: Check that package builds
2021-02-28 03:58:02 +01:00
runs-on: ubuntu-latest
steps:
2021-02-28 07:30:35 +01:00
- name: Checkout
uses: actions/checkout@v2
2021-03-14 01:02:54 +01:00
- name: Login to GitHub registry
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
2021-03-14 04:41:52 +01:00
- name: Get list of changed files
uses: lots0logs/gh-action-get-changed-files@2.1.4
with:
token: ${{ secrets.GITHUB_TOKEN }}
2021-02-28 07:30:35 +01:00
- name: Build Packages
run: |
PACKAGES=$(jq '.[]' -r ${HOME}/files.json | awk -F/ '{ print $2 "-" $3 }' | sort -u)
echo "Packages: $PACKAGES"
docker run -v "${{ github.workspace }}:/piston" docker.pkg.github.com/engineer-man/piston/repo-builder:latest --no-server $PACKAGES
2021-03-14 04:38:48 +01:00
ls -la packages
2021-03-14 00:34:54 +01:00
2021-03-14 01:49:30 +01:00
- name: Upload package as artifact
uses: actions/upload-artifact@v2
with:
name: packages
path: packages/*.pkg.tar.gz
2021-03-14 01:50:44 +01:00
test-pkg:
name: Test package
runs-on: ubuntu-latest
2021-03-14 01:52:20 +01:00
needs: build-pkg
2021-03-14 01:50:44 +01:00
steps:
2021-03-14 01:49:30 +01:00
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: packages
2021-03-14 00:34:54 +01:00
- name: Write test config file
2021-03-14 00:39:26 +01:00
uses: DamianReeves/write-file-action@v1.0
2021-03-14 00:34:54 +01:00
with:
path: data/config.yaml
contents: |
log_level: DEBUG
bind_address: 0.0.0.0:6969
data_directory: /piston
runner_uid_min: 1100
runner_uid_max: 1500
runner_gid_min: 1100
runner_gid_max: 1500
enable_unshare: false
output_max_size: 1024
max_process_count: 64
max_open_files: 2048
repo_url: http://piston_fs_repo:8000/index
write-mode: overwrite
2021-02-28 07:30:35 +01:00
- name: Run tests
run: |
docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder $PACKAGES &
2021-03-14 01:49:30 +01:00
docker run -v $(pwd)'/data:/piston' --name api docker.pkg.github.com/engineer-man/piston/api &
2021-02-28 07:30:35 +01:00
echo Waiting for API to start..
2021-03-14 00:34:54 +01:00
while [[ "$(curl -s -w '%{http_code}' http://api:6969/runtimes)" != "200" ]]; do sleep 5; done
2021-02-28 07:30:35 +01:00
echo Testing packages