Skip to content

Commit

Permalink
WIP: Migrate app-tests and app-page-layout-tests jobs to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
legoktm committed Aug 14, 2024
1 parent e76017f commit 35532b1
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 3 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,112 @@ jobs:
source .venv/bin/activate
make lint
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
id: cache
with:
path: ".cache"
key: ${{ runner.os }}-image-${{ hashFiles('securedrop/dockerfiles/focal/python3/*') }}
- if: ${{ steps.cache.outputs.cache-hit == 'true' }}
name: Load layers from cache
continue-on-error: true
run: |
docker load -i .cache/layers.tar
rm .cache/layers.tar
- name: Build image
run: |
DOCKER_BUILD_VERBOSE=true ./securedrop/bin/dev-shell true
- name: Export image layers
run: |
mkdir -p .cache
docker save -o .cache/layers.tar $(docker images -aq)
- uses: actions/cache/save@v4
with:
path: ".cache"
key: ${{ steps.cache.outputs.cache-primary-key }}

test-app:
runs-on: ubuntu-latest
needs:
- build-image
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
id: cache
with:
path: ".cache"
key: ${{ runner.os }}-image-${{ hashFiles('securedrop/dockerfiles/focal/python3/*') }}
- if: ${{ steps.cache.outputs.cache-hit == 'true' }}
name: Load layers from cache
continue-on-error: true
run: |
docker load -i .cache/layers.tar
rm .cache/layers.tar
- name: Build image
run: |
DOCKER_BUILD_VERBOSE=true ./securedrop/bin/dev-shell true
- name: Run application tests
run: |
make test-app
test-functional:
runs-on: ubuntu-latest
needs:
- build-image
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
id: cache
with:
path: ".cache"
key: ${{ runner.os }}-image-${{ hashFiles('securedrop/dockerfiles/focal/python3/*') }}
- if: ${{ steps.cache.outputs.cache-hit == 'true' }}
name: Load layers from cache
continue-on-error: true
run: |
docker load -i .cache/layers.tar
rm .cache/layers.tar
- name: Build image
run: |
DOCKER_BUILD_VERBOSE=true ./securedrop/bin/dev-shell true
- name: Run functional tests
run: |
make test-functional
test-pageslayout:
runs-on: ubuntu-latest
needs:
- build-image
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
id: cache
with:
path: ".cache"
key: ${{ runner.os }}-image-${{ hashFiles('securedrop/dockerfiles/focal/python3/*') }}
- if: ${{ steps.cache.outputs.cache-hit == 'true' }}
name: Load layers from cache
continue-on-error: true
run: |
docker load -i .cache/layers.tar
rm .cache/layers.tar
- name: Build image
run: |
DOCKER_BUILD_VERBOSE=true ./securedrop/bin/dev-shell true
- name: Run page layout tests
run: |
make test-pageslayout
- name: Validate HTML (informational)
run: |
make validate-test-html || true
- name: Validate accessibility (informational)
run: |
make accessibility-summary || true
rust:
runs-on: ubuntu-latest
# Keep version in sync with rust-toolchain.toml
Expand Down
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,24 @@ otp: ## Show (and opportunistically copy) the current development OTP (to the cl

.PHONY: test
test: ## Run the test suite in a Docker container.
@echo "███ Running SecureDrop application tests..."
@echo "███ Running all SecureDrop tests..."
@$(DEVSHELL) $(SDBIN)/run-test -v $${TESTFILES:-tests}
@echo

.PHONY: test-focal
test-focal: test
.PHONY: test-app
test-app: ## Run the application tests
@echo "███ Running SecureDrop application tests..."
TESTFILES="$(shell cd securedrop; echo tests/test*py)" $(MAKE) test

.PHONY: test-functional
test-functional: ## Run the functional tests
@echo "███ Running SecureDrop functional tests..."
TESTFILES="$(shell cd securedrop; echo tests/functional/test*py)" $(MAKE) test

.PHONY: test-pageslayout
test-pageslayout: ## Run the page layout tests
@echo "███ Running page layout tests..."
TESTFILES="$(shell cd securedrop; echo tests/functional/pageslayout/test*py)" $(MAKE) test

.PHONY: rust-test
rust-test:
Expand Down

0 comments on commit 35532b1

Please sign in to comment.