1- # TODO: Replace this line with the commented ones to actually run the action in your repo(s)
2- on : public
3- # on:
4- # push:
5- # branches:
6- # - main
7- # tags:
8- # - "*"
9- # pull_request:
1+ on :
2+ push :
3+ branches :
4+ - main
5+ tags :
6+ - " *"
7+ pull_request :
8+
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11+ cancel-in-progress : true
1012
1113name : CI
1214jobs :
1315 lint :
1416 name : Lint
15- runs-on : ubuntu-latest
17+ runs-on : ubuntu-22.04
1618 steps :
17- - uses : actions/checkout@v3
18- - uses : actions-rs/toolchain@v1
19- with :
20- toolchain : stable
21- override : true
19+ - uses : actions/checkout@v4
20+ - uses : dtolnay/rust-toolchain@stable
2221
2322 # make sure all code has been formatted with rustfmt
2423 - name : check rustfmt
@@ -35,164 +34,29 @@ jobs:
3534
3635 test :
3736 name : Test
38- strategy :
39- matrix :
40- os : [ubuntu-latest, windows-latest, macOS-latest]
41- runs-on : ${{ matrix.os }}
37+ runs-on : ubuntu-22.04
4238 steps :
43- - uses : actions/checkout@v3
44- - uses : actions-rs/toolchain@v1
45- with :
46- toolchain : stable
47- override : true
39+ - uses : actions/checkout@v4
40+ - uses : dtolnay/rust-toolchain@stable
4841 - run : cargo fetch
4942 - name : cargo test build
50- # Note the use of release here means longer compile time, but much
51- # faster test execution time. If you don't have any heavy tests it
52- # might be faster to take off release and just compile in debug
53- run : cargo build --tests --release
43+ run : cargo build --tests
5444 - name : cargo test
55- run : cargo test --release
45+ run : cargo test
5646
57- # TODO: Remove this check if you don't use cargo-deny in the repo
5847 deny-check :
5948 name : cargo-deny
60- runs-on : ubuntu-latest
49+ runs-on : ubuntu-22.04
6150 steps :
62- - uses : actions/checkout@v3
51+ - uses : actions/checkout@v4
6352 - uses : EmbarkStudios/cargo-deny-action@v1
6453
65- # TODO: Remove this check if you don't publish the crate(s) from this repo
6654 publish-check :
6755 name : Publish Check
68- runs-on : ubuntu-latest
56+ runs-on : ubuntu-22.04
6957 steps :
70- - uses : actions/checkout@v3
71- - uses : actions-rs/toolchain@v1
72- with :
73- toolchain : stable
74- override : true
58+ - uses : actions/checkout@v4
59+ - uses : dtolnay/rust-toolchain@stable
7560 - run : cargo fetch
7661 - name : cargo publish check
77- run : cargo publish --dry-run
78-
79- # TODO: Remove this job if you don't release binaries
80- # Replace occurances of $BIN_NAME with the name of your binary
81- release :
82- name : Release
83- needs : [test, deny-check]
84- if : startsWith(github.ref, 'refs/tags/')
85- strategy :
86- matrix :
87- os : [ubuntu-latest, macOS-latest, windows-latest]
88- include :
89- - os : ubuntu-latest
90- rust : stable
91- target : x86_64-unknown-linux-musl
92- bin : $BIN_NAME
93- # We don't enable the progress feature when targeting
94- # musl since there are some dependencies on shared libs
95- features : " "
96- - os : windows-latest
97- rust : stable
98- target : x86_64-pc-windows-msvc
99- bin : $BIN_NAME.exe
100- features : progress
101- - os : macOS-latest
102- rust : stable
103- target : x86_64-apple-darwin
104- bin : $BIN_NAME
105- features : progress
106- runs-on : ${{ matrix.os }}
107- steps :
108- - name : Install stable toolchain
109- uses : actions-rs/toolchain@v1
110- with :
111- toolchain : ${{ matrix.rust }}
112- override : true
113- target : ${{ matrix.target }}
114- - name : Install musl tools
115- if : matrix.os == 'ubuntu-latest'
116- run : sudo apt-get install -y musl-tools
117- - name : Checkout
118- uses : actions/checkout@v3
119- - run : cargo fetch --target ${{ matrix.target }}
120- - name : Release build
121- shell : bash
122- run : |
123- if [ "${{ matrix.features }}" != "" ]; then
124- cargo build --release --target ${{ matrix.target }} --features ${{ matrix.features }}
125- else
126- cargo build --release --target ${{ matrix.target }}
127- fi
128- - name : Package
129- shell : bash
130- run : |
131- name=$BIN_NAME
132- tag=$(git describe --tags --abbrev=0)
133- release_name="$name-$tag-${{ matrix.target }}"
134- release_tar="${release_name}.tar.gz"
135- mkdir "$release_name"
136-
137- if [ "${{ matrix.target }}" != "x86_64-pc-windows-msvc" ]; then
138- strip "target/${{ matrix.target }}/release/${{ matrix.bin }}"
139- fi
140-
141- cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "$release_name/"
142- cp README.md LICENSE-APACHE LICENSE-MIT "$release_name/"
143- tar czvf "$release_tar" "$release_name"
144-
145- rm -r "$release_name"
146-
147- # Windows environments in github actions don't have the gnu coreutils installed,
148- # which includes the shasum exe, so we just use powershell instead
149- if [ "${{ matrix.os }}" == "windows-latest" ]; then
150- echo "(Get-FileHash \"${release_tar}\" -Algorithm SHA256).Hash | Out-File -Encoding ASCII -NoNewline \"${release_tar}.sha256\"" | pwsh -c -
151- else
152- echo -n "$(shasum -ba 256 "${release_tar}" | cut -d " " -f 1)" > "${release_tar}.sha256"
153- fi
154- - name : Publish
155- uses : softprops/action-gh-release@v1
156- with :
157- draft : true
158- files : " $BIN_NAME*"
159- env :
160- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
161-
162- # TODO: Remove this job if you don't publish container images on each release
163- # TODO: Create a repository on DockerHub with the same name as the GitHub repo
164- # TODO: Add the new repo to the buildbot group with read & write permissions
165- # TODO: Add the embarkbot dockerhub password to the repo secrets as DOCKERHUB_PASSWORD
166- publish-container-images :
167- name : Publish container images
168- runs-on : ubuntu-latest
169- if : startsWith(github.ref, 'refs/tags/')
170- needs : [test, deny-check]
171- steps :
172- - name : Checkout
173- uses : actions/checkout@v3
174- - name : Set up QEMU
175- uses : docker/setup-qemu-action@v1
176- - name : Set up Docker Buildx
177- uses : docker/setup-buildx-action@v1
178- - name : Login to Dockerhub
179- uses : docker/login-action@v1
180- with :
181- username : embarkbot
182- password : ${{ secrets.DOCKERHUB_PASSWORD }}
183- - name : Docker meta
184- id : docker_meta
185- uses : crazy-max/ghaction-docker-meta@v1
186- with :
187- images : embarkstudios/${{ github.event.repository.name }}
188- tag-semver : |
189- {{version}}
190- {{major}}.{{minor}}
191- - name : Build and push
192- uses : docker/build-push-action@v2
193- with :
194- context : .
195- file : ./Dockerfile
196- push : true
197- tags : ${{ steps.docker_meta.outputs.tags }}
198- labels : ${{ steps.docker_meta.outputs.labels }}
62+ run : cargo publish --dry-run -p toml-span
0 commit comments