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: |
|
2021-03-14 04:43:50 +01:00
|
|
|
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
|
2021-03-14 06:11:39 +01:00
|
|
|
repo_url: http://localhost:8000/index
|
2021-03-14 00:34:54 +01:00
|
|
|
|
|
|
|
write-mode: overwrite
|
2021-02-28 07:30:35 +01:00
|
|
|
|
2021-03-14 05:59:21 +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 06:01:45 +01:00
|
|
|
|
2021-02-28 07:30:35 +01:00
|
|
|
- name: Run tests
|
|
|
|
run: |
|
2021-03-14 05:57:11 +01:00
|
|
|
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
|
2021-03-14 06:11:39 +01:00
|
|
|
docker run --network container:piston_fs_repo -v $(pwd)'/data:/piston' -d --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 05:57:11 +01:00
|
|
|
docker run --network container:api appropriate/curl --retry 10 --retry-connrefused http://localhost:6969/runtimes
|
2021-03-14 00:34:54 +01:00
|
|
|
|
2021-03-14 06:05:20 +01:00
|
|
|
echo Waiting for Index to start..
|
2021-03-14 06:08:37 +01:00
|
|
|
docker run --network container:piston_fs_repo appropriate/curl --retry 10 --retry-connrefused http://localhost:8000/index
|
2021-03-14 06:05:20 +01:00
|
|
|
|
2021-03-14 05:57:11 +01:00
|
|
|
echo Listing Packages
|
|
|
|
docker run --network container:api appropriate/curl http://localhost:6969/packages
|
2021-02-28 07:30:35 +01:00
|
|
|
|
2021-03-14 06:15:05 +01:00
|
|
|
docker logs api
|
|
|
|
docker logs piston_fs_repo
|
|
|
|
|
2021-02-28 07:30:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|