106 lines
3.1 KiB
YAML
106 lines
3.1 KiB
YAML
name: 'Package Pull Requests'
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- edited
|
|
- reopened
|
|
- synchronize
|
|
paths:
|
|
- 'packages/**'
|
|
|
|
jobs:
|
|
build-pkg:
|
|
name: Check that package builds
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Login to GitHub registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
registry: docker.pkg.github.com
|
|
|
|
- name: Get list of changed files
|
|
uses: lots0logs/gh-action-get-changed-files@2.1.4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- 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
|
|
ls -la packages
|
|
|
|
- name: Upload package as artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: packages
|
|
path: packages/*.pkg.tar.gz
|
|
|
|
|
|
test-pkg:
|
|
name: Test package
|
|
runs-on: ubuntu-latest
|
|
needs: build-pkg
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: packages
|
|
|
|
- name: Write test config file
|
|
uses: DamianReeves/write-file-action@v1.0
|
|
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://localhost:8000/index
|
|
|
|
write-mode: overwrite
|
|
|
|
- name: Login to GitHub registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
registry: docker.pkg.github.com
|
|
|
|
- name: Run tests
|
|
run: |
|
|
docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name piston_fs_repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build
|
|
docker run --network container:piston_fs_repo -v $(pwd)'/data:/piston' -d --name api docker.pkg.github.com/engineer-man/piston/api
|
|
echo Waiting for API to start..
|
|
docker run --network container:api appropriate/curl --retry 10 --retry-connrefused http://localhost:6969/runtimes
|
|
|
|
echo Waiting for Index to start..
|
|
docker run --network container:piston_fs_repo appropriate/curl --retry 10 --retry-connrefused http://localhost:8000/index
|
|
|
|
echo Listing Packages
|
|
docker run --network container:api appropriate/curl http://localhost:6969/packages
|
|
|
|
docker logs api
|
|
docker logs piston_fs_repo
|
|
|
|
|
|
|
|
|
|
|
|
|