Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More CI work #3

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 50 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ jobs:

- name: Build the MATE bdist
run: |
# Extremely annoying: the `pull_request` event creates a merge commit,
# which means that `GITHUB_SHA` is completely useless to key off of.
# We have to do some additional sleuthing for these events to get the right
# commit.
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi

docker run \
--rm -v $(pwd):/mate \
"ghcr.io/galoisinc/mate-dev:${ref}" \
"ghcr.io/galoisinc/mate-dev:${GITHUB_RUN_ID}" \
./shake.sh -j bdist

- name: Compress the MATE bdist
run: |
tar czf mate-bdist.tar.gz ./.out/bdist

- name: Upload the MATE bdist
uses: actions/upload-artifact@v3
with:
name: mate-bdist
path: mate-bdist.tar.gz

- name: Build and push the mate-dist image
run: |
# HACK: These files are owned by the container root, so we can't
Expand All @@ -60,16 +60,9 @@ jobs:

- name: Build the docs
run: |
# See above comment
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi

docker run \
--rm -v $(pwd):/mate \
"ghcr.io/galoisinc/mate-dev:${ref}" \
"ghcr.io/galoisinc/mate-dev:${GITHUB_RUN_ID}" \
./shake.sh -j doc

- name: Upload docs to Github Pages
Expand All @@ -78,3 +71,41 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .out/bdist/local/doc/html

test-legacy:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Login to Packages Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull mate-dev
run: |
docker pull "ghcr.io/galoisinc/mate-dev:${GITHUB_RUN_ID}"

# - name: Fetch the MATE bdist
# uses: actions/download-artifact@v3
# with:
# name: mate-bdist

# - name: Extract the MATE bdist
# run: |
# tar xzf mate-dist.tar.gz

- name: Run legacy tests
run: |
# TODO: Figure out the right way to plumb the integration test setting.
docker run \
-e MATE_INTEGRATION_TESTS=0 \
--rm -v $(pwd):/mate \
"ghcr.io/galoisinc/mate-dev:${GITHUB_RUN_ID}" \
./shake.sh --skip=build pytests -- -- -n logical -x

5 changes: 0 additions & 5 deletions ci/README.md

This file was deleted.

10 changes: 10 additions & 0 deletions ci/gha-docker-build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# gha-docker-build: build a MATE Docker image with some caching help

set -e

# This script only works in CI.
if [[ -z "${GITHUB_ACTIONS}" ]]; then
>&2 echo "Fatal: Only works in GitHub Actions."
Expand Down Expand Up @@ -50,6 +52,14 @@ docker build \

docker push "${full_image_name}:${ref}"

# Also tag it with the current workflow run ID, to make reuse in subsequent
# CI steps easier (no need to track the commit ref).
docker tag \
"${full_image_name}:${ref}" \
"${full_image_name}:${GITHUB_RUN_ID}"

docker push "${full_image_name}:${GITHUB_RUN_ID}"

# Additionally, if we're on main or we're doing a manually triggered build,
# tag the image as ":main".
if [[ "${GITHUB_REF_NAME}" == "main" || "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
Expand Down
16 changes: 0 additions & 16 deletions ci/ssh.sh

This file was deleted.