diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..079166e --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,38 @@ +name: Build Nightly Rust + +on: + workflow_dispatch: + schedule: + - cron: '0 2 * * 3' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + make build + make test + env: + RUST_VERSION: nightly + TAG: nightly + IMAGE: 'rustserverless/lambda-rust:nightly' + publish: + needs: [test] + if: github.repository == 'rust-serverless/lambda-rust' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: make publish + env: + RUST_VERSION: nightly + TAG: nightly + create_issue: + runs-on: ubuntu-latest + needs: [publish] + if: always() && (needs.publish.result == 'failure') + steps: + - run: gh issue create --title "Nightly publication failed" --body "Nightly publication failed" --label "bug" -R $GITHUB_REPOSITORY + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + \ No newline at end of file diff --git a/Makefile b/Makefile index 6388a68..3b101c4 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,17 @@ DOCKER ?= docker INPUT_RELEASE_VERSION ?= 0.4.0 RUST_VERSION ?= 1.55.0 REPO ?= rustserverless/lambda-rust +TAG ?= latest publish: build - $(DOCKER) push $(REPO):latest + $(DOCKER) push $(REPO):${TAG} publish-tag: build publish - $(DOCKER) tag $(REPO):latest "$(REPO):$(INPUT_RELEASE_VERSION)-rust-$(RUST_VERSION)" + $(DOCKER) tag $(REPO):${TAG} "$(REPO):$(INPUT_RELEASE_VERSION)-rust-$(RUST_VERSION)" $(DOCKER) push "$(REPO):$(INPUT_RELEASE_VERSION)-rust-$(RUST_VERSION)" build: - $(DOCKER) build --build-arg RUST_VERSION=$(RUST_VERSION) -t $(REPO):latest . + $(DOCKER) build --build-arg RUST_VERSION=$(RUST_VERSION) -t $(REPO):${TAG} . test: @tests/test.sh @@ -23,4 +24,4 @@ debug: build -v ${HOME}/.cargo/registry:/cargo/registry \ -v ${HOME}/.cargo/git:/cargo/git \ --entrypoint=/bin/bash \ - $(REPO) + $(REPO):$(TAG) diff --git a/tests/test.sh b/tests/test.sh index b200bff..0a2f1ba 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -4,7 +4,7 @@ HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # Root directory of the repository DIST=$(cd "$HERE"/..; pwd) -IMAGE=${1:-rustserverless/lambda-rust} +: "${IMAGE:=rustserverless/lambda-rust}" source "${HERE}"/bashtest.sh